【问题标题】:Cakephp 2.8 Pagination link number not clickableCakephp 2.8 分页链接号不可点击
【发布时间】:2016-08-22 22:28:05
【问题描述】:

首先对不起我的英语。

我正在尝试通过 cakePHP 2.8.3 使用 ajax 分页。

第一次加载效果很好。我看到了分页器号码:

当我单击页码“2”或“Next >>”时,内容 #content-recherche 会刷新,但链接页码 1(和链接“

这是我在控制器中的代码:

分页的公共变量:

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>

有人看看我的错误是什么?

谢谢。

【问题讨论】:

    标签: php cakephp pagination cakephp-2.8


    【解决方案1】:
    <div id="content-recherche">
    ...
    </div>
    <ul class="pagination">
    ...
    </ul>
    

    您没有更新/刷新&lt;ul class="pagination"&gt;&lt;/ul&gt; 中的代码。 当您刷新/更新&lt;div id="content-recherche"&gt;&lt;/div&gt; 块中的内容时,您还必须刷新/更新&lt;ul class="pagination"&gt;&lt;/ul&gt; 标记中的代码。

    【讨论】:

    • 好的,它更适合您的解决方案。感谢您的帮助
    猜你喜欢
    • 2015-02-13
    • 2012-11-26
    • 2021-04-02
    • 2017-10-11
    • 1970-01-01
    • 1970-01-01
    • 2014-01-22
    • 2014-09-11
    • 2013-09-06
    相关资源
    最近更新 更多