-
Hi I've just installed livewire tables on a brand new laravel 10 system and have added a column search but it seems to be one character behind on the searching If Ive got 2 records with values of ABC and ABD in the column and type in an A in the column search, a livewire network request is made but there is no rerender as you would expect and likewise when I add a B so its now AB Im searching for, but when I type in a C as well so I have ABC it still shows both. If i then add a 4th character it then does the ABC filter and removes the ABD record and then the 5th character then applies the 4 character search and at this point both records are now not found, as expected. Its as if the builder is running before the columnSearch has been updated with the additional character and in fact Ive added a dd within the builder()
and when I hit the 4th key it comes up with the 3 character search string instead. Any suggestions on what might be happening ? Thanks T |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
There are a few different config options for search. Keep in mind that your db will get queried with each character if you choose to use a non-debounced/non-lazy. Can you share your configure() method, and if you are using the builder() approach, the contents of that? Can you confirm whether you're tailwind or bootstrap (and version), package version, and Alpine version (and whether you're using a CDN, local or bundled? (If so - I'm assuming Vite?) |
Beta Was this translation helpful? Give feedback.
You are indeed correct.
It's an oddity with how everything loads in!
Rather than using the builder() function to set a search, either just set searchable() on the appropriate column, or you can use a callback on any column if you want:
That should keep in sync, much more smoothly. It applies to the filters as well, so make sure to use the filter() callback on the filter itself rather than using a when() statement in the builder!
Tables V3 is almost ready, and uses Livewire 3 by the way, but I'll likely backport some code to V2 and do some fixes…