Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

readme.md

VisualPaginator for Nette Framework

VisualPaginator Control for Nette Framework

This add-on creates visual paginator with localizations and with optional "all" button. It supports custom localizations and custom templates (default template is designed for Bootstrap 3).

Requirements

GNU Lesser General Public License

LGPL licenses are very very long, so instead of including them here we offer you URLs with full text:

Example

config.neon

extensions:
  translation: Kdyby\Translation\DI\TranslationExtension
  visualPaginator: RadekDostal\NetteComponents\VisualPaginator\VisualPaginatorExtension

translation:
  default: cs
  fallback: [cs_CZ, cs]
  whitelist: [cs, en]
  resolvers: # optional
    header: off

visualPaginator:
  translator: @translation.default
  #template: '%appDir%/components/VisualPaginator/custom.latte'
  #viewButtonAll: TRUE

Kdyby\Translation looks for localizations in the directory app/lang. For example english localization file must be named visualPaginator.en_GB.neon (in case of using the NEON syntax).

Presenter

class DefaultPresenter extends BasePresenter
{
  use \RadekDostal\NetteComponents\VisualPaginator\TVisualPaginator;

  public function renderDefault()
  {
    $paginator = $this['vp']->getPaginator();
    $paginator->setItemsPerPage(1);
    $paginator->setItemCount(10);
  }

  /**
   * Creates the visual paginator
   *
   * @return \RadekDostal\NetteComponents\VisualPaginator\VisualPaginator
   */
  protected function createComponentVp()
  {
    return $this->visualPaginator;
  }

  // For multiple paginators on the same page
  protected function createComponentVp2()
  {
    $control = $this->visualPaginator->create();
    // $control->setTemplate(...);
    
    // Dynamic change localization
    $control->getTranslator()->setLocale('en');
    
    return $control;
  }
}

Template default.latte

{control vp}