Closed Croug closed 2 years ago
Also may be useful to have an on:sort hook now, as some users may want to go back to the first page on sort
I'm assuming that you're planning to get this working in your app and tie the pagination + table. If you make a dead simple codesanbox I can eventually add that as a playground linked from the docs (see the /playground directory). Totally optional but would be super helpful if you feel compelled 😉
Sure thing I'll get on those changes either tonight or tomorrow, and I'll put something together for the playground.
Alright created the sandbox, I couldn't test it with the table itself as the playground uses the official agnosticui-svelte package, but I was able to test everything else in there, so we should be good, I'll work on the on:sort hook tomorrow
This appears to do as intended:
Thanks @Croug this is hugely helpful! Looking forward to the event dispatch! I'm keen to port this patch to the other frameworks as soon as that's in.
Not sure if you might have done something similar locally, but here's a little trick I use to test these sorts of things locally before they've been npm published…
cd agnostic-svelte
npm run package
cd package && npm pack && mv agnostic-svelte-1.1.18.tgz ..
And then from the playground
npm i ~/workspace/opensource/agnosticui/agnostic-svelte/agnostic-svelte-1.1.18.tgz
Running npm pack
generates the tarball as I understand the exact same as if you'd done npm publish
. And then you can test it before publishing locally. I've found it's much more reliable then npm link
.
And the wonderful result given your contribution!
That's just a single page sorted on grand slams col, but paginating around after clicking the various column sorts appears to be working 💪 🙌 It's quite cool to see this wired up @Croug 🙏 I'm very excited to also get the on:sort
event dispatcher too!
I think it probably makes sense for me to wait until on:sort
is in before doing an agnostic-svelte
npm version bump and publish (but I can't wait! 🕺 🔥 )
Description
I've added a limit and offset property to the Table component so it can be paginated easier via the Pagination component or otherwise. This also means that when sorting the table, all data will be sorted, not just visible data. Currently only implemented in Svelte.
Implements #161
Checklist: