実際にページ付けを必要とせずにすべてのレコードを表示できるようにしたいのですが、。のようなものを使用して、並べ替え可能な列ヘッダーを持つ機能を維持したいと考えています$this->Paginator->sort()
。
'limit' => 100
一度に約50を超えるレコードがないことを知っているため、現在設定しています。これは問題なく機能しますが、基本的に、他の方法でページを変更せずに並べ替え可能な列を実行する方法があるかどうかを知りたいと思いました。'limit' => unlimited
これを実現するCakePHPのまたは別のコンポーネントなど。
これがコントローラーです:
class GroupsController extends AppController {
public function view($slug = null) {
$group = $this->Group->findBySlug($slug);
$this->paginate = array(
'Person' => array(
'conditions' => array('Person.group_id' => $group["Group"]['id']),
'limit' => 100,
'recursive' => 0
)
);
$people = $this->paginate('Person');
$this->set('people', $people);
}
}
ビューは次のとおりです。
<table>
<tr>
<th><?php echo $this->Paginator->sort('Person.id','Id'); ?></th>
<th><?php echo $this->Paginator->sort('first_name', 'First Name'); ?></th>
<th><?php echo $this->Paginator->sort('last_name', 'Last Name'); ?></th>
</tr>
<!-- Here is where we loop through the people -->
<?php foreach ($people as $person): ?>
<tr>
<td><?php echo $person['Person']['id']; ?></td>
<td><?php echo $person['Person']['first_name']; ?></td>
<td><?php echo $person['Person']['last_name']; ?></td>
</tr>
<?php endforeach; ?>
<?php unset($player); ?>
</table>