Pages

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Saturday, July 28, 2012

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