簡體   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