你能说出为什么排序不适用于这个动作:
public function admin_view($id = null)
{
if (!$this->Category->exists($id)) {
throw new NotFoundException(__('Invalid product'));
}
$this->Paginator->settings = array(
'conditions' => array(
'Category.' . $this->Category->primaryKey => $id),
'limit' => $this->limit
);
$this->set('category', $this->paginate('Category'));
}
并且查看看起来:
<th><?php echo $this->Paginator->sort('price'); ?></th>
<?php foreach ($category[0]['Product'] as $product): ?>
<tr>
<td><?php echo h($product['price']); ?> </td>
</tr>
<?php endforeach; ?>
当我点击价格时,它刷新我的页面,但排序不起作用。出了点问题,我不知道为什么。
答案 0 :(得分:0)
public function view($id = null)
{
if (!$this->Product->exists($id)) {
throw new NotFoundException(__('Invalid product'));
}
$this->Paginator->settings = array(
'conditions' => array(
'Product.' . $this->Product->primaryKey => $id)
);
$this->set('product', $this->paginate('Product');
}