Skip to content

Pagination plug-in : no_total #60

Open
wants to merge 2 commits into from

6 participants

@HichamLaghbidi

no_total pagination plug-in can be used to display data even when the total number of records is unknown.

Display three buttons : first, previous, and next.
Next is clickable as long as iTotalRecords has not been sent.

@DataTables
Owner

This looks really interesting - thanks for the patch! I can't do an automatic merge since you've edited the generated file, and the paginating plug-in shouldn't go into the core, but I will certainly look at adding this ability to cope with an undetermined end point to the DataTables core.

@mcintyre321

Has this, or a similar feature been merged in?

There are definitely a few people asking for this feature.

I'd be happy to re-work the pull request above, if you could give me a few pointers on who it ought to be integrated. It seems to me like a reasonable feature to have in the core, rather than a plugin though - providing a (potentially expensive) row count...

@DataTables
Owner

No - this feature doesn't exist in DataTables at the moment. I'm a little concerned it will impact more than just the paging I suspect (Scroller for example would be incompatible with this). I think at the moment I would prefer to see this as a plug-in, particularly with the new paging plug-in architecture making it easy to define which buttons are available (simply don't include a 'last' button - although the 'next' will likely need an additional event listener).

Two reasons why I'd like to see this as a plug-in:

  1. The core size is already larger than I would like and although it has been asked for before, it has only been brought up a couple of times.
  2. I've been thinking about other changes for the server-side processing / client-side comms, including the ability for the server to change the display start point - so doing both at the same time probably makes sense.
@mcintyre321

Thanks for the detailed response. Does the new plugin architecture mean that nothing in the core will need to change in order to create a plugin for this?

Re: point 2 - the server can change the start point by writing/overwriting the storage cookie*, no?

*as I write this I realise cookies are out, localstorage is in... this is a shame for us server side developers, it was handy getting passed the state on each request!

@DataTables
Owner

Heh - yes, its all about the localStorage now... I haven't actually thought of using the cookie to see the client-side state before. You could add the state information using the new state() API method and ajax.data, or you can switch back to using cookies if you want to provide your own state saving callbacks.

Does the new plugin architecture mean that nothing in the core will need to change in order to create a plugin for this?

In the case of the lack of a 'last' button, that certainly is the case. This is how DataTables defines its paging buttons in 1.10: https://github.com/DataTables/DataTablesSrc/blob/master/js/ext/ext.paging.js#L38 . So you would just not have a last button.

In the case of the next button it will probably be a little more complicated and might require a custom renderer to be created next block down from the one in the link above). Possibly you might be able to bind an event listener that would execute before the DataTables button listener, and cancel the event under the conditions required. That would be the best way of doing it, but I'm not sure that it would be possible to bind a listener that will execute before DataTables' own...

@alexwilbur

This really should be addressed. It's been open for several years now and means this control is not well suited to any kind of nosql/big-data backing store.

@DataTables
Owner

Yes I should try and make time to look into this - I've had other development priorities but it would be good to have this ability. The major concern is that the number of records is used by other plug-ins such as Scroller would would simply fail outright without this information being available. That would need to be clearly documented somewhere, and it is not clear to me where that would be. This along with other things would need to be addressed before merging it in.

@alexwilbur

Understood. I think you are probably the only person that has the Big Picture and can add this feature in a way that won't harm other parts of the stack. I ended up branching the data tables code to add this support (similar to the original pull request) - but I don't need the scroller etc. so this was clearly just a quick & dirty hack.

Overall, very impressed with the control!

@jamesryanbell

Hi

Has there been any progress on this feature? I am dealing with a large table and providing the total is really slowing down the ajax requests.

Thanks,
James

@DataTables
Owner

No - sorry. I will update here when I do get a chance to look into it.

@j16sdiz
j16sdiz commented Feb 16, 2016

still looking for similar feature.
I have a time-series dataset will with multi millions of rows.

Counting them is impossible, but I can navigate by page (if the page number is small) or filter by time range .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.