Sortable() and Searchable() not behaving as expected
Hello,
Not sure why this Filament table is not behaving as expected when clicking the arrow to sort or typing into the search field. Suggestions?
https://gist.github.com/wrperin/e6181516c7606e1e352bc0d424cca6ad
Gist
Livewire component with Filament table - Filament sortable() and se...
Livewire component with Filament table - Filament sortable() and searchable() not behaving as expected - ListMembers.php
Solution:Jump to solution
Well, I've made some progress! I used a bit of Povilas' alpine.js conflict article, and I added in my livewire component class. This fixed my sortable and searchable problem!...
12 Replies
Can you also share the layout template? My gut tells me you might be missing the @filamentScripts directive. Also, when using a full page component like this, livewire looks for
resources/views/components/layouts/app.blade.php
as the layout file, unless you changed the global layout inside config/livewire.php
This means that you shouldn't have to inherit the global layout in your component's view.
(<x-app-layout>
is not needed)
Also, to be safe, try using composer update
to bump filament/filament to v3.2Thanks Tuto, I haven't changed the global layout inside config/livewire.php (I don't have that file). And it is confusing to me which app.blade.php layout is being used; there is more than one of them and one does have the @filamentScripts and the other doesn't. I'll play around with that.
I think by using <x-app-layout> you are using the one that doesn't.
Try using this approach to use the correct layout and still have access to extra slots, like header
https://livewire.laravel.com/docs/components#setting-additional-layout-file-slots
Laravel
Components | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
Let me know how it goes 👍
Thanks Tuto; I haven't attempted to update the layout file per the article you sent yet; however, I removed all the code except in the file. When I view the source in the browser, the correct layout with the @filamentScripts directive seems to be loaded because the last few lines of the page are and yet the sorting and searching behaviors are not working.
can you share the contents of
resources/views/components/layouts/app.blade.php
Also, are there any errors in the browser's console or network tab?Thank you for looking at this for me Tuto! The gist has been updated with the layout file https://gist.github.com/wrperin/e6181516c7606e1e352bc0d424cca6ad
And yes, there are 8 console errors, may of the same error, thanks for having me check that! The console errors are about alpine js.
Gist
Livewire component with Filament table - Filament sortable() and se...
Livewire component with Filament table - Filament sortable() and searchable() not behaving as expected - ListMembers.php
I found this article and am trying this out https://laraveldaily.com/post/livewire-3-laravel-breeze-error-alpine-js-conflict
Solution
Well, I've made some progress! I used a bit of Povilas' alpine.js conflict article, and I added in my livewire component class. This fixed my sortable and searchable problem!
I still am working on the layout issue with more than one slot, but that's less of a concern for my project.
Thanks for all your help Tuto!
I'm glad you were able to move forward. If there's anything else I can help you with, don't hesitate to ask