src/Grid.php
public function addItemsPerPageSelector($items = [10, 25, 50, 100], $label = 'Item per pages:')
    {
        if ($ipp = $this->container->stickyGet('ipp')) {
            $this->ipp = $ipp;
        } else {
            $this->ipp = $items[0];
        }

        $pageLength = $this->paginator->add(['ItemsPerPageSelector', 'pageLengthItems' => $items, 'label' => $label, 'currentIpp' => $this->ipp], 'afterPaginator');
        $this->paginator->template->trySet('PaginatorType', 'ui grid');

        if ($sortBy = $this->getSortBy()) {
            $pageLength->stickyGet($this->name.'_sort', $sortBy);
        }

        $pageLength->onPageLengthSelect(function ($ipp) use ($pageLength) {
            $this->ipp = $ipp;
            $this->setModelLimitFromPaginator();
            //add ipp to quicksearch
            if ($this->quickSearch instanceof jsSearch) {
                $this->container->js(true, $this->quickSearch->js()->atkJsSearch('setUrlArgs', ['ipp', $this->ipp]));
            }
            $this->applySort();

            //return the view to reload.
            return $this->container;
        });

        return $this;
    }
public function addItemsPerPageSelector($items = [10, 25, 50, 100], $label = 'Item per pages:')
    {
        if ($ipp = $this->container->stickyGet('ipp')) {
            $this->ipp = $ipp;
        } else {
            $this->ipp = $items[0];
        }

        $pageLength = $this->paginator->add(['ItemsPerPageSelector', 'pageLengthItems' => $items, 'label' => $label, 'currentIpp' => $this->ipp], 'afterPaginator');
        $this->paginator->template->trySet('PaginatorType', 'ui grid');

        if ($sortBy = $this->getSortBy()) {
            $pageLength->stickyGet($this->name.'_sort', $sortBy);
        }

        $pageLength->onPageLengthSelect(function ($ipp) use ($pageLength) {
            $this->ipp = $ipp;
            $this->setModelLimitFromPaginator();
            //add ipp to quicksearch
            if ($this->quickSearch instanceof jsSearch) {
                $this->container->js(true, $this->quickSearch->js()->atkJsSearch('setUrlArgs', ['ipp', $this->ipp]));
            }
            $this->applySort();

            //return the view to reload.
            return $this->container;
        });

        return $this;
    }
public function addItemsPerPageSelector ( $ items = [ 10 , 25 , 50 , 100 ] , $ label = 'Item per pages:' ) { if ( $ ipp = $ this -> container -> stickyGet ( 'ipp' ) ) { $ this -> ipp = $ ipp ; } else { $ this -> ipp = $ items [ 0 ] ; } $ pageLength = $ this -> paginator -> add ( [ 'ItemsPerPageSelector' , 'pageLengthItems' => $ items , 'label' => $ label , 'currentIpp' => $ this -> ipp ] , 'afterPaginator' ) ; $ this -> paginator -> template -> trySet ( 'PaginatorType' , 'ui grid' ) ; if ( $ sortBy = $ this -> getSortBy ( ) ) { $ pageLength -> stickyGet ( $ this -> name . '_sort' , $ sortBy ) ; } $ pageLength -> onPageLengthSelect ( function ( $ ipp ) use ( $ pageLength ) { $ this -> ipp = $ ipp ; $ this -> setModelLimitFromPaginator ( ) ; //add ipp to quicksearch if ( $ this -> quickSearch instanceof jsSearch ) { $ this -> container -> js ( true , $ this -> quickSearch -> js ( ) -> atkJsSearch ( 'setUrlArgs' , [ 'ipp' , $ this -> ipp ] ) ) ; } $ this -> applySort ( ) ; //return the view to reload. return $ this -> container ; } ) ; return $ this ; }
Add ItemsPerPageSelector View in grid menu or paginator in order to dynamically setup number of item per page.

@param array  $items An array of item's per page value.
@param string $label The memu item label.

@throws Exception

@return $this
Add ItemsPerPageSelector View in grid menu or paginator in order to dynamically setup number of item per page .