Simple ajax pagination and sorting with CakePHP

Today i gonna to tell how to implement simple Ajax pagination with CakePHP. The following resources used for the ajax pagination and sorting or filtering.

  • Jquery
  • Ajax
  • CakePHP pagination element

First, make sure you include Paginator component in your controller. Then you must define jquery function for Ajax call in your custom jquery file then it must be include to your layout.

AJAX:

then you must add class “ajax-pagination” in parent div of included pagination element.I mean

My pagining_links.ctp has following code:

whenever user clicks the pagination link then we makes the ajax request to get the content and replace the existing content with requested content in parent of its div. Refer my complete view file code (Ajax based pagination and Sorting )

 

 

 

  • kriz

    Hi. I know this article is an old one but i stumbled across it at it leaves me with questionmarks.
    I dont see the full view.ctp you mention and even more important it seems like you dont have any informations on what changes to the controller i need to make. If you could add these informations you’d help me and other possible visitors alot!