PHP Solutions

For apply ajax pagination in cakephp 2.x.x follow these below steps:

Image

1). Copy File JqueryEngineHelper.php From lib/Cake/View/Helper and Paste to  app/View/Helper.

2). Include Latest jQuery File to your layout file for ajax paging.

ex- in app/View/Layouts/ajaxpagination.ctp

<!DOCTYPE html>
<html>
<head>

<!– This is mandotary –>
<?php echo $this->Html->script(‘http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js’); ?>
</head>
<body>


Html->image(‘indicator.gif’, array(‘id’ => ‘busy-indicator’)); ?>



</body>
</html>

NOTE: Here ‘indicator.gif’ image is a loader image.you can place this image in app/webroot/img directory.

3).  To make Javascript enhanced links instead of plain HTML links, you have to use options() parameter to paginator helper .

ex- In your view ctp file add the following:

<!– This is mandotary –>
<?php $this->paginator->options(array(‘update’ => ‘#content’,’before’ => $this->Js->get(‘#spinner’)->effect(‘fadeIn’, array(‘buffer’ => false)),’complete’ => $this->Js->get(‘#spinner’)->effect(‘fadeOut’, array(‘buffer’ => false))));?>

Showing Page <?php echo $this->paginator->counter(); ?>
<table>
<tr>
<th><?php echo $this->paginator->sort(‘Post.title’, ‘Title’);?></th>

View original post 137 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s