CakePHP Ajax Pagination
CakePHP Ajax Pagination
It's a good practice to use inbuilt design component to build our web application. CakePHP offer many inbuilt component as well as helper.Ajax Pagination is also a great component / helper to build interactive web application.
To implement Ajax Pagination in your application follow these steps:-
Step1:
Include RequestHandler component and Js helper in your controller.
public $components = array('RequestHandler'); public $helpers = array('Js');
Step 2:
Add JQuery library to your current Layout either javascript or cakephp script tag, if already included skip this step.
echo $this->Html->script('jquery');Step3:
In your view(ctp) add following line at top most section.
$this->Paginator->options(array( 'update' => '#content', 'evalScripts' => true));
Here we define the div which will update by ajax request and "#content" is id of the div.
Step4:
Now add your presentation part in view
Step 5:
And at last of your view add following line of code to add javascript to call ajax pagination.
echo $this->Js->writeBuffer();If you have any doubt place comment or follow this link
Ajax Pagination
hi, it's working but, it loads the whole page in the div area.
ReplyDeletethanks
some here is any solution
ReplyDeleteGovind
it's not working. it shows the error undefined variable paginator..
ReplyDeleteThnx it works for me
ReplyDelete