Hide Pagination and Page Limits unless more than 1 page is loaded
Hide Pagination and Page Limits unless more than 1 page is loaded
I have DT all over my app, and since im still just developing it, a lot of the tables just have a few rows in it, and they all have the pagination buttons and the page limit dropdown. I was wondering, is there a way to have DT hide both of those, unless the minimum limit has been passed?
Meaning if the pagination is set to 10 rows per a page, and theres 10 or less rows, hide the two features.
I know I could use some JS to get the row count and disable the features, which I might do, was just wondering if this was already a feature that I overlooked.
Answers
P.S. I saw some posts about this in the forums, but they were from 2009, so thought id ask again.
http://datatables.net/forums/discussion/131/disabling-pagination-navigation-when-returning-only-one-page-of-results
What I did was just use a callback to determine the settings based off of the rows and pagination settings...
If not enough rows in the table to do anything (Meaning less than the minimum display length), hide filter, pagination, display length)
Otherwise, toggle the pagination based on the current page length setting
If theres a dynamic way to set page_min by getting the lengthMenu settings somehow via the API, that would be neat.. as opposed to having to change page_min every time the DT settings are changed.
I know you can do something like...
But what if its not ordered in the right way, or ... other stuff
Actually, I found this: https://github.com/DataTables/Plugins/blob/master/features/conditionalPaging/dataTables.conditionalPaging.js
/palmface