beforeRender a handler – nette 2.3
- esskeetit123
- Člen | 1
Ahoj, narazil jsem na problem pri pagination – delam v nette 2.3
ve zkratce ->
na webu je tlacitko ktere po kliknuti udela ten signal a prebira si to
v presenteru handler.
- Handler se normalne zapne, a po prvnim kliknuti to jde, obsah se redrawne a vykresli se dalsi polozky.
- Pocet zobrazovanych polozek se updatne a ulozi do session.
- Kdyz ovsem kliknu znovu, nic se nedeje → handler si to sice prebere ale posila uplne stejne data jako v posilal v predchozim requestu.
rikam si jestli v tom nemuze hrat nejakou roli beforeRender.
Udelal jsem si tedy pomocnou promennou, ktera se s kazdym kliknutim na handler zvetsi, ale ta tez zustava stejna? Nemate nekdo nejakou radu. + uplne stejny kod bezi na nette 3.0
public function handlePaginationMore($name, $url = '')
{
$this->numberBD++;
$this->itemsPerPage = $this->getSession('itemsPerPage');
$this->itemsPerPage[$name] = (($this->itemsPerPage[$name] ?: $this->paginationDefaults[$name]) + $this->paginationDefaults[$name]);
if ($url === 'search') {
$url = $this->link('search');
} else {
$url = $this->link('this', ['visualPaginator-page' => null]);
}
$this->payload->url = $url;
$this->payload->page = round($this->itemsPerPage[$name] / $this->paginationDefaults[$name]) + ($this['visualPaginator']->page - 1);
$this->template->perPage = $this->itemsPerPage[$name];
$this->payload->pomocnaPromenna = $this->numberBD;
if ($this->isAjax()) {
$this->reloadPagination = false;
$this->redrawControl('h1_text');
$this->redrawControl('products_list');
} else {
$this->redirect('this');
}
}