久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Cakephp 3.x 中的分頁排序

Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁排序)
本文介紹了Cakephp 3.x 中的分頁排序的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在 cakephp 3.x 中我不能在 find 中做分頁順序

In cakephp 3.x i can't do paginate order in a find

這是我的控制器:

//AgentsController.php
public function show()
{
    $agents = $this->Agents->find()
    $this->set('agents', $this->paginate($agents));
}

這里是我的部分觀點

//show.ctp
<!-- ....... -->
<table class="table table-striped">
   <thead>
      <tr>
        <th>
            <?php echo $this->Paginator->sort('full_name', 'Nome', array('escape' => false)); ?>
        </th>
        <th>
            <?php echo $this->Paginator->sort('username', 'Email', array('escape' => false)); ?>
        </th>
        <th>
            <?php echo $this->Paginator->sort('regions', 'Regioni', array('escape' => false)); ?>
        </th>
      </tr>
   </thead>
<!-- ....... -->

我錯在哪里?

推薦答案

分頁器將阻止任何按您正在使用的查詢的主表中不存在的列進行排序的嘗試.在這種情況下,您有 2 個選擇.第一個選項是更改排序鏈接以告訴 cake 該列屬于相關表:

The Paginator will block any attempt of sorting by a column that does not exist in the primary table of the query you are using. In this case you have 2 options. The first option is changing the sort links to tell cake that the column belongs to a related table:

<?php echo $this->Paginator->sort('Users.full_name', 'Nome'); ?>

或者您可以在組件中告訴它允許按給定的一組列進行排序:

Or you can tell it in the component that sorting by a given set of columns is allowed:

$this->paginate = ['sortWhitelist' => ['full_name', 'username']]

這篇關于Cakephp 3.x 中的分頁排序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作為類名,因為它是保留的 Cake 2.2.x)
Session is lost after an OAuth redirect(OAuth 重定向后會話丟失)
CakePHP Shared core for multiple apps(CakePHP 多個應用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯誤:允許的內存大小為 134217728 字節已用盡(嘗試分配 87 字節))
How to get complete current url for Cakephp(如何獲取 Cakephp 的完整當前 url)
主站蜘蛛池模板: 亚洲va欧美va天堂v国产综合 | 免费黄色的视频 | 国产欧美在线 | 欧美三级三级三级爽爽爽 | 日韩欧美操 | 在线观看视频福利 | 午夜影院在线观看视频 | 成人免费视频网站在线观看 | 人人草天天草 | 国产精品一区二区免费看 | www.日韩| 午夜99| 久久久成人一区二区免费影院 | 国产偷自视频区视频 | 精品视频在线播放 | 午夜欧美a级理论片915影院 | 欧美激情久久久 | 中文字幕av在线 | 一区二区三区四区在线 | 中文字幕一区二区三区乱码图片 | 欧美日韩国产欧美 | 夜夜爽99久久国产综合精品女不卡 | 一本色道精品久久一区二区三区 | 九九色九九 | 色婷综合网 | 国产亚洲精品精品国产亚洲综合 | 欧美日韩在线精品 | 欧美一区二区三区四区在线 | 午夜影院网站 | 久久精品久久久久久 | 国产精品美女久久久久aⅴ国产馆 | 中文字幕在线视频一区二区三区 | 特级特黄特色的免费大片 | 东京久久| 亚洲电影专区 | 久久er精品 | 亚洲在线一区二区三区 | 一级在线观看 | 婷婷不卡 | 日韩在线三级 | 在线观看成人 |