-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
table pagination #84
Comments
Hi ! You can paginate tables manually using Here is an example, let me know if it does what you want: https://replit.com/@pimaj62145/SQLPage-pagination?v=1 -- render the table
SELECT 'table' AS component;
SELECT * FROM todo
WHERE id >= COALESCE($start_id, 0) ORDER BY id LIMIT 5;
-- render the page numbers with links for pagination
SELECT 'steps' as component, true as counter;
SELECT format('?start_id=%s', id) AS link
FROM (SELECT id, ROW_NUMBER() OVER (ORDER BY id) AS table_index FROM todo)
WHERE table_index % 5 = 1; Paginating in the component itself on the frontend wouldn't be very useful, since that would require loading all the data all of the time anyway. Is that what you were looking for ? |
Thanks, it works fine. I hadn't seen |
If you have a very large table, then maybe what you need is not pagination, but search, or faceted navigation ? What exactly is in the table and what do you want your users to do with it ?
Is there something else I can help you with ? |
Sorry for late answer. I compare your tool with what can be done with datasette. Thanks! |
All of that seems very possible with SQLPage, and you'll end up with something that looks better and if more versatile than datasette. Let me know if there's something you're having troubles implementing in SQLPage, I'll be happy to help. |
You can try this: Put this in your big query: and then create some navigation buttons SELECT 'button' as component,
TRUE AS center;
SELECT '|<' as title,
'?offset=0&page=' || IFNULL($page, 25) as link,
cast(IFNULL($offset, 0) as integer) <= 0 as disabled;
SELECT '<<' as title,
'?offset=' || (IFNULL($offset, 0) - IFNULL($page, 25)) || '&page=' || IFNULL($page, 25) as link,
cast(IFNULL($offset, 0) as integer) <= 0 as disabled;
SELECT '>>' as title,
'?offset=' || (IFNULL($offset, 0) + IFNULL($page, 25)) || '&page=' || IFNULL($page, 25) as link
; you can move or copy the navigation buttons section before the query, so they appear at the top |
Hello, Thanks to the excellent tutorial, I've knocked up an example of pagination that works with large tables. The name My example is here: https://github.com/ggaughan/SQLpage_examples/tree/main/pagination_efficient It needs SQLPage v0.18.0 or higher (the |
Hi,
thanks for this project that I exploring for an SQLite quick frontend.
So, is there a way to paginate large tables?
As it's mentionned in the wishlist/roadmap (#69), I guess it's not...
The text was updated successfully, but these errors were encountered: