nattreid/visual-paginator

Visual Paginator for Nette Framework

1.4.2 2018-10-08 12:52 UTC

README

class SomePresenter {

    function renderDefault() {
        $model = $this->model->findAll();
        $this['paginator']->setPagination($model);
        $this->template->model = $model;
    }

    function createComponentPaginator() {
        $paginator = new \NAttreid\VisualPaginator\VisualPaginator(10); // 10 polozek na strance, klasicke odkazy

        $paginator = new \NAttreid\VisualPaginator\VisualPaginator(20); // 20 polozek na strance, ajax -> invalidace snippetu 'data'

        $paginator->prev = 'Předchozí';
        $paginator->next = 'Další';
        $paginator->other = '...';
        
        $paginator->setAjaxRequest(); // volani pres ajax
        $paginator->setNoAjaxHistory(); // vypne historii pres ajax
        
        $paginator->onClick[] = function(VPaginator $paginator, $page){
            // php kod
        };

        return $paginator;
    }
}