Replies: 1 comment 3 replies
-
This is expected behaviour, as otherwise each time you check a box, a full lifecycle event occurs, which can be problematic, especially with larger tables (for example when having 250 complex rows displayed). You can access the list of "selectedItems" in AlpineJS as "selectedItems", which would allow you to show/hide a button, or access what's been selected in the frontend. selectedItems stays sync'd with the backend, but is aware of what has been selected (prior to the lifecycle occurring) What's the purpose of your button? Bulk Actions may be your best bet if you want to interact with the select boxes. For example, in your "livewire.tables.button" blade add:
And you'll be able to see the list of all selectedItems (including prior to pagination). |
Beta Was this translation helpful? Give feedback.
-
Hi there, I have this strange issue, I need to fetch the current number of the selected rows.
When I check the demo here https://tables.laravel-boilerplate.com/tailwind?users1[filters][active]=1 when I select or deselect a checkbox this array is populated, screenshot:
However, when I debug enable this does not happen on my side:
And the array is populated only if I select different page in the pagination, for example if I click on 2 or 5 then the array in the debugger will be populated.
So, if I try to do this:
$this->setConfigurableAreas([ 'toolbar-right-end' => [ 'livewire.tables.button', [ 'selectedCount' => count($this->selectedCount), ], ], ]);
it won't work it will always stay 0 (zero) until I paginate on another page in the table. What I want to do is show a button if the count is more than 3 selected.
Any help and tip is appreciated, thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions