大家好,我试图在我的一个视图中对表格进行分页,我的 find 语句返回了正确的结果集,但是我不确定如何让我的表格能够对我找到的信息进行排序。
这是控制器,当我尝试分页时发现我得到的只是错误
public function index_admin(){
//displays all disputes related to account.id
//in a dashboard for an administrator user
$this->set('title_for_layout', 'Dispute');
$this->set('stylesheet_used', 'homestyle');
$this->set('image_used', 'eBOXLogoHome.png');
$this->layout='home_layout';
//gets the User.account_id
$id = $this->Auth->User('account_id');
$conditions=array("OR"=> array(
'Invoice.sender_id' => $id,
'Invoice.receiver_id' => $id));
$receiver=$this->Dispute->find('all',array(
'conditions'=>$conditions));
$this->set('receiver',$receiver);
$this->paginate('Dispute');
$this->set('id',$id);
}
这是视图的代码
<tr>
<th><?php echo $this->Paginator->sort('id', 'Invoice ID'); ?></th>
<th><?php echo $this->Paginator->sort('dispute_date', 'Dispute Created'); ?></th>
<th><?php echo $this->Paginator->sort('status', 'Status'); ?></th>
<th>Actions</th>
</tr>
<?php foreach($receiver as $receivers):?>
<tr>
</tr><tr>
<td><?php echo $receivers['Invoice']['id'] ;?></td>
<td><?php echo $receivers['Dispute']['dispute_date'] ;?></td>
<?php
if($receivers['Dispute']['active']==1)
{
$status = 'Active';
$bgcol = '#B9FAEA';
}
else
{
$status = 'Resolved';
$bgcol = '#FAB9B9';
}
?><td align='center' bgcolor='<?php echo $bgcol ?>'><?php echo $status ?></td>
<td><?php echo $this->Form->Html->link('View',
array('controller' => 'Messages','action'=>'viewMessage_admin',$receivers['Dispute']['id'])); ?>
<?php echo $this->Form->Html->link('Resolve',
array('controller' => 'Disputes','action'=>'resolve',$receivers['Dispute']['id'])); ?></td>
</tr>
<?php endforeach; ?>