0

複数のテーブルを示すスクリーンショットに参加しました。すべて同じクエリから発生しているにもかかわらず、ページネーターが複数の「表示された」テーブルを処理するようにしたいと思います。'Id'列は多くの列の1つであることに注意してください。

 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>

並べ替えは機能しません。DESCではなくASCを注文するだけです。

4

1 に答える 1

1

これは単なる検索呼び出しであるため、paginateを複数回使用できます。Cakeから渡されたパラメータを再利用します。

$records = $this->paginate();

必要に応じて、この呼び出しに特別な条件を渡すことができます。

于 2012-06-18T15:49:54.013 に答える