Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Pagination Enhancements and Ideas
  • 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.

    Some initial things that come to mind are:

    1) Adding First/Last paging link capabilities

    2) Modifying num_links to render something like: 
                 FirstLink PrevLink 1  2 ... 22  23 NextLink LastLink

    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.
  • Which fuel version are you using?

    These is all already possible with Pagination...

    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?).
  • Using 1.4,

    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.


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion