Skip to content
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

Feature-request: server-side pagination for dynamic(/changing) data #450

Open
hepcat72 opened this issue Feb 7, 2022 · 1 comment
Open

Comments

@hepcat72
Copy link

hepcat72 commented Feb 7, 2022

I was trying to figure out how to enable server-side pagination for my implementation of bootstrap-table for very large tables (hundreds of thousands of rows) that are a part of an advanced search page. The data is the result of a complex search query (using ands and ors, e.g.: tissue is brain and (compound is lysine or compound is glucose)). The search parameters are stored in a JSON object which is passed to the server via a form. The actual query on the server (for queries resulting in large data sets) takes a relatively long time. My hope was that bootstrap-table's server-side pagination would allow me to pass in a limit and an offset that I could use in the query (as well as the sort field and sort direction) so that I could shorten the query time as well as the rendering time.

When I was trying to figure out what I needed to do to implement the server-side pagination that bootstrap table provides, I really didn't know what to expect, but I was looking for how to pass in the limit, the offset, the sort field, and the sort direction (asc or desc). I found the data-url, but none of the examples demonstrated how to send the limit and offset (let alone the sort field and sort direction), so I figured I would skip the query speed improvement for now and settle for the rendering speed improvement (since I'd already implemented caching to improve the query speed).

However, I quickly realized that I also had no way to pass in the JSON-ized search parameters from the client to the data URL in order to retrieve all the data either. I presume that the data-url is assumed to be either a static flat file or a request for data that doesn't change.

The only mechanism I can figure I could use to get the data would be to implement some javascript for the onSort and onPageChange events in order to query the server using a POST to retrieve what I need for each page. (However, I'm not even sure how to decorate the contents of the table the way I currently do using a django template. But since it seems like I cannot get server-side pagination to do what I need, I feel like it might be overall easier to use Django's pagination features so I don't have to reimplement the template...).

So this feature request is to provide a way to set a POST data-url along with values to send in the post. In my case, all I want to send is my JSON-ized search query. But I would also need an example that will show me what the form elements for limit, offset, sort_field, and sort_direction are named and what to expect their values to be (e.g. sort_direction will be either ASC or DESC). Presumably, sort_field would be whatever we set as the data-field and the limit and offset would be starting row number (as opposed to page number) and number of rows per page.

@smillove
Copy link
Contributor

smillove commented Feb 7, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants