Twitter/Facebook Style Pagination

Twitter/Facebook Style Pagination

steetyjsteetyj Posts: 3Questions: 0Answers: 0
edited January 2011 in Plug-ins
Hey guys, Just wondering if a plug-in exists to enable pagination similar to the way twitter and facebook do it?

Basically I want to have a "More" button at the end of the table that brings back the next "page" and appends it to the existing results. So if I start with 10 results, clicking the button would load 10 more and append them to the previous 10, letting the table size grow. This would ideally work with server-side processing of course.

If no plugin exists would anyone be able to point me in the right direction to begin writing this functionality myself?

Replies

  • ikselaiksela Posts: 13Questions: 0Answers: 0
    I believe this is a bit like this: http://www.datatables.net/examples/basic_init/scroll_y_infinite.html
  • steetyjsteetyj Posts: 3Questions: 0Answers: 0
    Hey thanks that is pretty close to what I am looking for
  • allanallan Posts: 63,400Questions: 1Answers: 10,451 Site admin
    What you could possibly do (I've not tried it, but I can't think of why it wouldn't work...) is to set the scroll loading gap (the number of pixels before the bottom of the scroll for when the new data is loaded) to a negative number ( http://datatables.net/usage/options#iScrollLoadGap ) and then add a little button at the bottom of the table (might need to use fnDrawCallback for that) which when clicked will load the next data set (fnPageChange('next') should do that).

    Allan
  • steetyjsteetyj Posts: 3Questions: 0Answers: 0
    thanks alan I will give it a try. Any chance a pagination feature like this could get built into a future release??
  • allanallan Posts: 63,400Questions: 1Answers: 10,451 Site admin
    If it proves a popular request - sure! Mostly likely I would think of building it as a plug-in though - I think that would probably be the best way to offer this kind of feature, since it likely wouldn't be used in 90+% of cases.

    Allan
This discussion has been closed.