CakePHP:一次对多个HTML表进行排序

CakePHP:一次对多个HTML表进行排序,php,cakephp,sorting,paginator,Php,Cakephp,Sorting,Paginator,我加入了显示多个表的屏幕截图。我希望paginator能够处理多个“显示”表,尽管它们都来自同一个查询。请注意,“Id”列是许多列中的一列 var $paginate = array( 'limit' => 1000); function index() { $this->Immeuble->recursive = 1; $this->Immeuble->contain('Agenc

我加入了显示多个表的屏幕截图。我希望paginator能够处理多个“显示”表,尽管它们都来自同一个查询。请注意,“Id”列是许多列中的一列

 var $paginate = array(
            'limit' => 1000);

    function index() {
            $this->Immeuble->recursive = 1;
            $this->Immeuble->contain('Agence');
            $this->set('results', $this->paginate());
            $agences = $this->Immeuble->find('count', array('fields' => 'DISTINCT Agence.Nom'));
            $this->set('agences',$agences);
            $ii = 0;
            $records = $this->Immeuble->find("all",array('fields'=>'Immeuble.id,Immeuble.image,Immeuble.description,Immeuble.start_date,Immeuble.end_date$
            $this->set('records',$records);
            }
在我看来,这是我的分页者部分:

<tr>
                       <th><?php echo $this->Paginator->sort('Id','id'); ?></th>
                       <th><?php echo $this->Paginator->sort('description');?></th>
                       <th><?php echo $this->Paginator->sort('start_date');?></th>
                       <th><?php echo $this->Paginator->sort('end_date');?></th>
                       <th><?php echo $this->Paginator->sort('image');?></th>
                       <th><?php echo $this->Paginator->sort('ordre');?></th>
                       <th><?php echo $this->Paginator->sort('agence_id');?></th>
                       <th class="actions"><?php __('Actions');?></th>
</tr>


您可以多次使用paginate,因为它只是一个查找调用。它将重用Cake传递的参数

$records = $this->paginate();

如果需要,您可以将特殊条件传递给此调用。

当按下定位键时,分页器无法排序。虽然小箭头将显示,url将更改。您是否使用
$results
显示所有数据
$records
将无法正确分页/排序,因为您没有使用
Controller::paginate()
来查找它们(您可以这样做,并且它将对请求使用相同的排序)。我如何实际声明另一个分页器?它会覆盖我已经设置的参数吗?不会,
$this->paginate()
只是一个使用paginator参数的特殊查找调用。如果同时使用
$records=$this->paginate()
,它将对该数据进行分页。如果你愿意,你可以给它传递特殊条件,尽管从你发布的代码来看,它看起来和第一个调用完全一样,没有分页。它现在可以工作了,谢谢你,哈里斯先生。虽然当我使用不同的标题对结果进行排序时,它会移动我的表顺序(对IDs ASC进行排序时的最后一个表将在DESC上首先进行排序),但有没有办法只在它们的表中对结果进行排序?