繁体   English   中英

CakePHP:一次排序多个HTML表

[英]CakePHP: Sorting multiple HTML tables at once

我加入了显示多个表的屏幕截图。 我希望分页器使用多个“显示”表,尽管它们都源自同一查询。 请注意,“ 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>

排序将不起作用,它将仅排序ASC,而不是DESC。

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

$records = $this->paginate();

如果需要,可以为此呼叫传递特殊条件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM