Juste pour info la pagination est hyper-simple
au niveau controller tu dois faire un truc du genre suivant (ici c'est pour l'action index)
public function index() {
$this->set('title_for_layout',"TITRE DE TA PAGE");
$this->MODEL->recursive = 0; // tu changes MODEL avec le nom de ton model genre: Pots, User, Produit etc....
$this->paginate = array(
'limit' => 20, // la tu met le nombre d'élements par page
'order' => array('champ' => 'asc'), // ici tu met à la place de champ le nom du "champ" surlequel tu veut faire un tri (ASC ou DESC)
);
$this->set('data', $this->paginate());
}
puis dans ta vue (ici ce sera /app/View/MODEL/index.ctp tu mets ceci
....
<hr />
<table cellpadding="0" cellspacing="0" class="table table-bordered table-hover">
<tr>
<th><?php echo $this->Paginator->sort('id','id'); ?></th>
<th><?php echo $this->Paginator->sort('name','nom'); ?></th>
<th><?php echo $this->Paginator->sort('champ1','titre champ1'); ?></th>
<th><?php echo $this->Paginator->sort('champ2','titre champ2'); ?></th>
<th>Opérations</th>
</tr>
<?php
foreach ($data as $poste): ?>
<tr>
<td><?php echo h($poste'MODEL']'id']); ?> </td>
<td><?php echo h($poste'MODEL']'name']); ?> </td>
<td><?php echo h($poste'MODEL']'champ1']); ?> </td>
<td><?php echo h($poste'MODEL']'champ2']); ?> </td>
<td class="actions">
<?php echo $this->Html->link('<i class="icon-eye-open icon-white"></i> Consulter', array('action' => 'view', $poste'MODEL']'id']),array('escape'=>false,'class'=>'btn btn-success')); ?>
<?php echo $this->Html->link('<i class="icon-pencil icon-white"></i> Editer', array('action' => 'edit', $poste'MODEL']'id']),array('class'=>'btn btn-info','escape'=>false)); ?>
<?php echo $this->Form->postLink('<i class="icon-remove icon-white"></i> Effacer', array('action' => 'delete', $poste'MODEL']'id']),array('class'=>'btn btn-danger','escape'=>false), __(Configure::read('message.msg_verifsupprimer').'# %s?', $poste'MODEL']'id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="alert alert-info">
<?php
echo $this->Paginator->counter(array(
'format' => __('Page <strong>{:page}</strong> sur<strong>{:pages}</strong>, affichage de <strong>{:current}</strong> sur un total de <strong>{:count}</strong>, premier <strong>{:start}</strong>, Dernier <strong>{:end}</strong>')
));
?> </div>
<div class="pager">
<?php
echo $this->Paginator->prev('<< ', array('tag'=>'li'), null, array('tag'=>'li','class' => 'disabled'));
echo $this->Paginator->numbers(array('separator' => ''));
echo $this->Paginator->next(' >>', array('tag'=>'li'), null, array('tag'=>'li','class' => 'disabled'));
?>
</div>
....
A présent pour ce qui est de Ajax ca se passe en faite dans le controller avec un petit indice qui viens de ton interface (ta vue)
Donc pour l'indice tu va sous le repertoire app/view/layout et dans le fichier default.ctp (qui contient ton template) tu cherches les lignes suivantes:
<div id="content">
<?php echo $content_for_layout; ?>
</div>
et la pour l'indice ca t'indique que le contenu sera chargé ton un div ayant l'id "content" (noté #div en selecteur css ou jQuery)
puis pour l'ajax tu as juste à dire ou se fera l'update et tu lui donne l'id précédemment trouvé
$this->Paginator->options(array(
'update' => '#content', // Ca c'est l'id de la div ou sera afficher le contenu de tes pages tu le trouve dans la vue default.ctp sous le repertoire app/view/layout
'evalScripts' => true, // ca c'est pour dire que si dans le code de retour ou la page de retour chargé par ajax il y a un script, est ce qu'il doit l'evaluer/executer ou non
'before' => $this->Js->get('#busy-indicator')->effect('fadeIn', array('buffer' => false)), // ca c'est dans la doc et en gros ca veut dire avant d'aller chercher les pages demande affiche (avec l'effet fade/fondu) la div dont l'id est #busy-indicator et qui contient en principe le message de "chargement des données) Pour info au niveau de css tu dois avoir ceci #busy-indicator{display:none;} pour que cet element soit caché
'complete' => $this->Js->get('#busy-indicator')->effect('fadeOut', array('buffer' => false)), // la c'est pour faire disparaitre l'element busy-indicator quand les données on été chargé
));
Et rappelle toi de mettre en haut du controller ou tu as mis ce code d'importer les components et helpers suivant
public $components = array('RequestHandler');
public $helpers = array('Js');
Voila, le mieux et d'essayer, quitte a t’emmêler les pinceaux... sur le tas ca deviens bien plus claire