Server side paging with unknown record count
Server side paging with unknown record count
This has been an ongoing discussion for the last couple of years, but I can't find a useful answer.
What are people doing for the scenario where a total record count is infeasible/expensive to calculate?
In this case I want just Prev/Next buttons, and a 'Page X' for info display.
Before I spends hours trying to hack this I'm hoping someone can post their solution.
What are people doing for the scenario where a total record count is infeasible/expensive to calculate?
In this case I want just Prev/Next buttons, and a 'Page X' for info display.
Before I spends hours trying to hack this I'm hoping someone can post their solution.
This discussion has been closed.
Replies
There is actually a pull request on this topic which I've yet (I'm ashamed to say since its been outstanding for a while!) to properly review: https://github.com/DataTables/DataTables/pull/60 . It might give you a starting point though.
I'd be interested to know how you get on with it if you do follow up on it and if it is a fairly light change, then perhaps it is something that I should look at incorporating into 1.10. It should only be the paging and info that really "care" about it - so it might be possible to support view plug-ins only.
Regards,
Allan
I'm sure a few others would also like to see this in core.
I'm using Mongo DB and it's expensive to do counts - and likely the same with increasing number of NoSQL options.
Always having 'next' enabled isn't a problem - its just the ending point that I don't know how to handle correctly...
Allan
I incorporated his plugin fnUpdate to a bootstrap themed plugin and made a change to disable Next when the returned record count is < page size, doesn't need to be any more complicated than that.
I also made a couple more single line changes to prevent (filtered...) being displayed when iTotalRecords is NaN.
In the case of having 100 records, Next will unfortunately be enabled and return an empty page - not a showstopper.
You could have the server return { bNoMoreRecords: true } as an option instead of disabling Next if record count < page size.