Skip to content

pvy/nette-visual-paginator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nette-visual-paginator

Vizualni paginator pro Nette 2+

Priklad pouziti na strankach puvodniho projektu:

Zde je navic moznost pridat do tridy VisualPaginator callback:

  • Bez nej je zachovana puvodni funkcionalita.
  • S nim sablona jako odkaz na stranky pouziva signal (+class="ajax") a v jeho handleru vyvola callback.

Ukazka obsluhy ajaxu v komponente nebo presenteru:

class ExampleControl extends \Nette\Application\UI\Control {
  
	// ...

	public function render() {
		// priklad strankovani kolekci je na webu puvodniho projektu:
		// http://addons.nette.org/cs/visualpaginator
	}
	
	/**
	* trigger pro udalost strankovani
	* @param \Nette\Application\UI\Control $component
	* @param int $page
	*/
	public function triggerShowPage($component, $page) {
		//jen invalidovat, paginator si stranky ohlida sam
		if ($this->presenter->isAjax()) {
			$this->invalidateControl();
		} else {
			$this->presenter->redirect('this');
		}
	}

	/**
	* tovarnicka na paginator
	* @param strint $name
	*/
	public function createComponentPaginator($name) {
  		$vp = new VisualPaginator($this, $name);
		$vp->onShowPage[] = callback($this, 'triggerShowPage');
		return $vp;
	}
}

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%