Closed Polve closed 9 months ago
Pagination is handled externally: You'd do something like this (where you make the components, and YourTable wraps the headless table)
<Data as |d|>
<YourTable @data={{d.records}} />
<Pagination @meta={{d.meta}} @onNext={{d.nextPage}} />
</Data>
records would be tracked, no when the pagination component tells the data component to update, the table component updates because of auto tracking
The pagination interface in this repo was accidentally left in, and isn't actually used, afaik
Thanks
in the example above, how can I tell the table that I changed the @data (without triggering a new route)?
Why don't you want to trigger a route transition? Generally folks want table state serialized to the URL
Because I have several tables inside my page and I want to be able to paginate each one indipendently
If you move all data loading for each table into component-land instead of the route, your goal is very doable
yes that's my goal, but how do I trigger a table redraw after pressing the pagination buttons?
In the example, if records is @tracked
, and your function for handling page changes updates records, there is nothing for you to do. The framework handles the update 🎉
I can share a real/runnable example later if you're still stuck
Everything works as expected, thanks! I close this since I overlooked #163 that was already on topic
In the class list I found something related to pagination but I can't find any example using it so I'm unable to understand how to use it