Paginator – limit – cakePHP 3

Daje możliwość zmiany ilości rekordów dla użytkownika

 

<th scope="col" class="">
   <?php if($show_limit): ?>
       <?= $this->Paginator->limitControl([15 => 15, 25 => 25, 50 => 50, 100 => 100], 25, 
            ['label' => false, 
                'id' => 'limit',
                'class' => 'form-control mb-0 mt-3',
                'title' => 'Ilość rekordów na stronie',
                'value' =>   $this->request->getParam('paging')['Events']['limit'] 
                           ? $this->request->getParam('paging')['Events']['limit'] 
                           : 25
                ]) ?>
   <?php endif; ?>
</th>

Controller

$this->paginate = [
  'contain'   => [],
  'conditions => [],
  'limit'     => 10,
  'maxLimit'  => 100
];

Dodaj komentarz