Attempting to use ListeRecords Tabs in with Standalone Tables with a modified trait
So i setup a simple trait that does the basics and it kind of works. The problem is that on initial page load, the query is happening twice. The second issue is that i have to click a tab twice for it to do the modifier. Seems on the first click it just loads the last query and ive confirmed that with ray, the second one uses the modifier. So how can i avoid it running the table query twice on page load and then having to click twice?
PropertiesTable livewire component
Trait File
`
Solution:Jump to solution
@awcodes https://gist.github.com/MACscr/baaeeddbfe39c85840410c66257596ae. Not perfect, but works quite well for standalone usage of table tabs
15 Replies
I guess i really need to figure out the proper way to modify a table query when it comes to standalone
I want to help but I can’t follow this discord code formatting on my phone. 😅
@awcodes well i guess i just need to know how i can dynamically modify a query when using standalone tables. Its different than using hte panel builder version. Same methods arent available as far as i can tell
Hmm, using on the table seems to work
Im betting there is a cleaner way though
@archilex can answer this one way better than me. But it should still be fairly simple in stand alone too. Is it just the tab click that changes the query?
So, it’s really just a hijacked filter?
Maybe you don’t need to directly modify the query but update the query string instead and let the query handle itself. I could be making this up too, sorry.
yes, i did think about having a wire:click just enable/disable a filter, but I like being able to add these tabs without adding more filters
Fair enough. Just sounds a lot like his filter sets plugin.
oh, for sure. I even have a filter sets license. I just only needed this small set of features. That author is the one that implemented it for core for the panel builder version
as always though, i have to rebuild everything for the standalone version. lol
I do the same sometimes.
Well, I tagged him so maybe he’ll respond. Lol.
oh man, i love this feature. You can even apply filters on top of it. customers are going to love it
Imagine how excited they’ll be to have the full screen available instead of your modals. Jk. 😜
Solution
@awcodes https://gist.github.com/MACscr/baaeeddbfe39c85840410c66257596ae. Not perfect, but works quite well for standalone usage of table tabs
Good job.
Well it looks like toggling columns or sorting screws things up, so looks like i need to take those into consideration
@awcodes no rush, but mind marking this thread as unsolved if possible?
Sorry. I’ll try when I get home. Doesn’t look I can from my phone.
So since im now using , so as you can see, Im simply monitoring when the activeTab is changed, now I can also monitor other events like 'mountedTableAction', 'mountedTableBulkAction', 'tableSearchQuery', 'updatedTableFilters' and then there is sorting too. Turns into kind of a mess and of course and also means if i set this in a trait, its a pain for the class using it to then monitor those events for other purposes without doing something like . Suggestions for better implementing this?