Saturday 11 July 2009

jQuery Paginator

Need to paginate server-side data with jQuery? Try this plugin for pagination with jQuery and PHP that I created at work.


If you need any help or have any comment make your post...

Cheers

11 comments:

  1. Hi !

    I just made the example work, but what I see, is that all the records to show are pulled from the server on one single request only. It is posible to make a new request each time a page, prev or next link is clicked, pulling only a small set of records each time?

    ReplyDelete
  2. Hi Andrew,

    I think it should be possible although I haven't made any attempt of doing it, so don't take me for granted.

    I personally prefer making less requests to the server and also there is the need to run a query on all records anyway in order to get total rows, etc...

    You may want to try limiting the query first and then attach listeners for NEXT and PREV to get other records and updating the DOM accordingly, but still you will need also listeners for each page number and so on. It might be more complicated this way.

    Good luck and let me know if you have managed to do it.

    Cheers

    ReplyDelete
  3. hi
    can i get a copy of the php file
    http://www.myjquery.co.uk/paginators_data/demo_news_data.php
    because i am getting some problems...
    please help...

    ReplyDelete
  4. @kk

    Sure...What sort of problems do u have?

    ReplyDelete
  5. Hi Carlo,
    Can you place the code onto github? would like to fork & improve. Would like as Andrew said to add some smart caching (preload 1 page item in advance), use getJSON and to add json instead search&replace html code.

    ReplyDelete
  6. Hello Marius,

    Sure, no problem... Give me a few days though. Need to find the time.

    I will post here when I have set up an account at github.

    ReplyDelete
  7. Thank you for this wonderful tool! How do I get the callback function to work?

    ReplyDelete
  8. Using the example I could not get paginator working, but moving the script to the bottom of my page, everything is working fine.

    ReplyDelete
  9. Nice plugin but bad tutorial, can you zip full example with all files (including .php) that will help alot. Thanks

    ReplyDelete
  10. Hello I have an issue with forms in the pages, as I go to next page the form always resets.Can I get around this?

    ReplyDelete
  11. solved it with a hack.

    The problem. The script creates a memory of the results, and pulls each page from the memory divs without resaving any changes to the pages before change. So I had to figure out a way to see what the current page is during a page change, and then apply changes to the original "memory" pages.

    It was tricky getting the id of the current page, if this was a variable included in the class then it would be cleaner (good update idea).

    If you are in a similar situation and would like to look at my code please email me at adistantbox at gmail.com .

    ReplyDelete