首先抱歉我的英语。
我正在尝试使用带有cakePHP 2.8.3的ajax分页。
第一次加载效果很好。我看到了分页符编号:
当我点击页码“2”或“下一步>>”时,内容 #content-recherche 正在刷新但链接页码为1(并且链接“<< ;上一个“)不可用。 页码“2”保持可点击状态......
这是我在控制器中的代码:
分页的公共变量:
public $paginate = array('Entite' => array(
'limit' => 2,
'order' => array(
'Entite.nom' => 'asc'
),
));
我的行动中的代码:
$this->Paginator->settings = $this->paginate;
$this->Paginator->settings = array(
'conditions' => $conditions,
//'limit' => $sql_limit
'limit' => 2
);
$data = $this->Paginator->paginate('Entite');
$this->set('data', $data);
我在视图中的代码:
<div id="content-recherche">
...
</div>
<ul class="pagination">
<?php
$this->Js->JqueryEngine->jQueryObject = 'jQuery';
$this->Paginator->options(array(
'update' => '#content-recherche',
'url' => array('controller' => 'Recherche', 'action' => 'coiffure'),
'complete' => '$.getScript("/js/utils.js", function (data, textStatus, jqxhr) {});',
'evalScripts' => true,
));
?>
<?php
echo $this->Paginator->numbers(array(
'first' => '<<',
'currentClass ' => 'active',
'tag' => 'li',
'modulus' => 5,
'last' => '>>'));
?>
<?php
echo $this->Paginator->prev(
'« Previous', null, null, array('class' => 'disabled')
);
echo $this->Paginator->next(
'Next »', null, null, array('class' => 'disabled')
);
?>
</ul>
有人看到我的错误是什么?
感谢。
答案 0 :(得分:3)
<div id="content-recherche">
...
</div>
<ul class="pagination">
...
</ul>
您没有在<ul class="pagination"></ul>
中更新/刷新代码。
刷新/更新<ul class="pagination"></ul>
块中的内容时,您还必须刷新/更新<div id="content-recherche"></div>
标记中的代码。