Is there a way to get all the ids for the rows that are showing on the current table page? #1051
Replies: 8 comments 10 replies
-
Follow-up question: is there an event to hook into for |
Beta Was this translation helpful? Give feedback.
-
Few options off the top of my head, but easiest one would be:
setAllSelected() Then use getSelected elsewhere to get the IDs. As for pagination, it depends whether you're using Tailwind or Bootstrap, but the pagination is standard and you can override gotoPage in your component and just make sure you call the original method at the end. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the insight, here is what I ended up using:
The mount takes care of the first-load (including working if you are already in page 2 or something, by referencing |
Beta Was this translation helpful? Give feedback.
-
I've come across another solution for this while doing some modifications to the Bulk Actions if you're interested, it involves a modification to the pagination blade, but then will give you the current IDs for the page. |
Beta Was this translation helpful? Give feedback.
-
I will look at populating this by default if the primaryKey is set, just to save everyone some pain! |
Beta Was this translation helpful? Give feedback.
-
One other quick note. If you don't need it in the data table component, and just need it in a blade or another component then you can do away with the entangle piece and access the array via alpine elsewhere. |
Beta Was this translation helpful? Give feedback.
-
This may make it into the next release yet, I've just added it into the development branch
If you're using the develop branch then you should see two new public variables:
|
Beta Was this translation helpful? Give feedback.
-
Available in v2.12.0 let me know if you need clarification! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
For example, 100 rows and I am only looking at page 2, elements 10-20, and I want to always know the IDs on the current page view?
Beta Was this translation helpful? Give feedback.
All reactions