Digging into pagination after getting my first project setup. Got the basics working and rendering with the bootstrap template. Planning on revisiting after getting some next base items working on my project, but wanted to float the topic of enhancing the pagination class out there.
3) Parameters to not show/calculate total number of pages (this is nice sometimes if you have very large data sets and want to show some paging to the user but dont want to pay the count() query cost
Anyone have other ideas or needs around their pagination use cases? Would be nice to collect them, dont know when I will start extending for my own needs but depending on other feedback can take some of that into account.
Except 3, which I don't find very useful. A count is inexpensive if you have an index (so speed is related to table design), and you still need the count to determine the page boundaries (i.e. what happens if you type in 16 in the URL when there are only 12 pages?).
After looking through docs and code and getting my first implementation done, didnt see how 1) and 2) would be done. For instance, in limiting the num_links value to 2 with a 5 page result it just showed the middle pages (ie: 2 3).
For 3) scenario if you add any advanced search functionality on data sets with large number of records, you wont have indexes on all the fields (think models with ~20 properties with complex search query). Lots of background in the enterprise/CRM space and ran into this several times with implementations where people would be doing report like saves searches and the count queries would be big extra hit on load times. As far as typing in errant page, mindset is user is never typing in anything, just navigating via links/forms
Ah, ok, I get what you mean now. You want the option to always slow first/last, no matter which links are generated? Can you create a ticket for this feature request?
I still have mixed feelings about 3. I understand your reasoning, but have issues with being dependent on "a user not typing anything". And it doesn't have to be that, it could also be a bookmark made when page x existed, and requested when x is no longer there.
Also, you need the count to determine the last page, so if you don't have a count, you can not display a last-page link.