首先为我的英语道歉。
我试图在cakePHP 2.8.3中使用ajax分页。
第一个负载运行良好。我看到了分页编号:

当我单击页码"2“或"Next >>”时,内容#是刷新的,但是链接页号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>有人看到我的错误了吗?
谢谢。
发布于 2016-08-23 03:53:59
<div id="content-recherche">
...
</div>
<ul class="pagination">
...
</ul>您没有在<ul class="pagination"></ul>中更新/刷新代码。在<ul class="pagination"></ul>块中刷新/更新内容时,还必须刷新/更新<div id="content-recherche"></div>标记中的代码。
https://stackoverflow.com/questions/39089656
复制相似问题