Use Scroller without pagination?
Use Scroller without pagination?
marianopeck
Posts: 53Questions: 8Answers: 0
Hi guys. I can't use the pagination provided by DataTables. Instead, I am using my own pagination, based on server side etc.. I would not like to change this now...Anyway, with the usage of DataTables, the header is fixed and always visible, which is very nice. Hence, I can usually have many rows displayed at the same time. Say, 1000, whatever. So I would love to use the Scroller there, but without using Pagination facilities. I tried to do it but I get a popup saying: "DataTables warning (table id = 'id32'): Pagination must be enabled for Scroller". I really don't understand why Pagination is mandatory. Cannot you simply consider the whole table as a page?
Anyway, any workaround is deeply appreciated.
Thanks!
Anyway, any workaround is deeply appreciated.
Thanks!
This discussion has been closed.
Replies
So no, there is no work around at the moment, and likely won't be one without a complete retooling of Scroller and possibly DataTables.
Allan
In the CSS, set:
div.dataTables_paginate {
display:none;
}
That will make it so none of the pagination buttons show up.
Then in the CSS, set:
div.dataTables_length {
display:none;
}
That will make it so the dropdown to select the number of rows per page does not show up.
Finally, set the iDisplayLength to -1 in your js function:
"iDisplayLength": -1
That will make the default number of rows per page be set to all.
Though, I'm not sure how it will work if you are still looking to do server-side pagination on your datatables tables. But this will allow you to display all the items without showing pagination features, while still using the scrollbar.
I think the workaround of jgoulet is what I was looking for! And I don't use the server-side pagination of datatables. I mean, my app is server-side, I have my own pagination rendered OUTSIDE the html table... Each request goes to the server and the table is rendered on the client. So for the plugin point of view, all it gets is a table in the DOM, no matter if those elements are all, or a page, or what page etc...so I think this workaround is safe for my case, isn't it?