Componette

Componette

aleswita

aleswita / VisualPaginator v4.0.2

Visual Paginator for Nette Framework.

download-cloud-line composer require aleswita/visualpaginator

Visual Paginator

Visual Paginator for Nette Framework.

Build Status Coverage Status PHPStan

Installation

The best way to install AlesWita/VisualPaginator is using Composer:

$ composer require aleswita/visualpaginator

Usage

Neon

services:
	- AlesWita\VisualPaginator\VisualPaginatorFactory

Presenter

<?php declare(strict_types = 1);

use AlesWita\VisualPaginator\VisualPaginator;
use AlesWita\VisualPaginator\VisualPaginatorFactory;
use Nette\Application\UI\Presenter;

final class HomePresenter extends Presenter
{

	/** @inject */
	public VisualPaginatorFactory $visualPaginatorFactory;

	public function actionDefault(): void
	{
	    $this['paginator']->setItemCount(1000);
	    $offset = $this['paginator']->getOffset();
	    $itemsPerPage = $this['paginator']->getItemsPerPage();

	    ['SELECT * FROM `orders` LIMIT ? OFFSET ?', $itemsPerPage, $offset];
	}

	protected function createComponentPaginator(): VisualPaginator
	{
		$paginator = $this->visualPaginatorFactory->create();

		$paginator->ajax = true;
		$paginator->canSetItemsPerPage = true;
		$paginator->templateFile = __DIR__ . '/my_awesome_template.latte';

		return $paginator;
	}

}

Template

{control paginator}

Custom paginator template

{templateType AlesWita\VisualPaginator\Template}
...
  • v4.0.2 v4.0.2

    Diff: v4.0.1...v4.0.2

    Changes:

  • v4.0.1 v4.0.1

    Diff: v4.0.0...v4.0.1

    Changes:

    • items per page fix
  • v4.0.0 v4.0.0

    Completely refactor of this package with lots of BC breaks, but clearest code and up to date dependencies.

  • 3.0 Version 3.0

    For Nette Framework: ~2.4.0 || ~3.0.0
    For PHP: ~7.1.0

  • 2.0 Version 2.0

    For Nette Framework: ~2.3.0 || ~2.4.0
    For PHP: ~7.0.0 || ~7.1.0

    Further development of this paginator will focus on Nette Framework 2.4/3.0 and PHP 7.1.

  • 1.0 Version 1.0

    For Nette Framework: ~2.3.0
    For PHP: ~5.6.0

    Further development of this paginator will focus on Nette Framework 2.3/2.4 and PHP 7.0.

price-tag-2-line

Badges

guide-fill

Dependencies

php (^7.1)
nette/di (^2.4 || ^3.0.0)
nette/utils (^2.4 || ^3.0.0)
nette/application (^2.4 || ^3.0.0)
nette/http (^2.4 || ^3.0.0)
nette/forms (^2.4 || ^3.0.0)
latte/latte (^2.4 || ^3.0.0)
Componette Componette felix@nette.org