【发布时间】:2015-05-10 23:20:44
【问题描述】:
在 cakephp 3.x 中,我无法在查找中进行分页顺序
这是我的控制器:
//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>
<!-- ....... -->
我哪里错了?
【问题讨论】:
-
您的意思是单击排序链接之一时?如果是这样,生成的 url 是什么?
-
/admin/agents/show?sort=username&direction=asc
-
你能把生成的 SQL 显示在 debukit 中吗?
-
没有order by。只有 Select、From、Join、Limit 和 offset
-
用户名是代理表的一列吗?
标签: php cakephp cakephp-3.0