Re: Pear pager getPerPageSelectBox (solved)

From: Date: Tue, 05 Sep 2006 12:44:18 +0000
Subject: Re: Pear pager getPerPageSelectBox (solved)
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25070@lists.php.net to get a copy of this message
Thanks to Lorenzo Alberton for the hint, this works: ..... $renderer = $dg->setRenderer('Pager'); $renderer = $dg->getRenderer(); $pager = $renderer->getContainer(); $selectBox = $pager->getPerPageSelectBox(5, $numitems-1, 5, true, '%d per pagina'); ..... > Il 11:24, martedì 5 settembre 2006, Lorenzo Alberton ha scritto: > > Alessandro Pasotti wrote: > > > Does anybody know how to implement getPerPageSelectBox with the new > > > Pager? > > > > > > The function has disappeared :( > > > > > > I see also that with the new driver there is not any reference to the > > > Pager object anymore (in previous versions one could do > > > $dg->renderer->pager), so even if the function getPerPageSelectBox > > > would exists it would be impossible to call it. > > > > it's still there, I simply moved it in another > > file, which is lazy-loaded when the user calls > > that method (which is proxied by the base class). > > > > What is your problem, exactly? > > The problem is that the attached code doesn't work anymore: it basically > adds an onchange method to the select box. > > Perhaps there is another way to do the same thing. > > Thank you for helping. > > ----- > > $selectBox = '&nbsp;' . > $dg->renderer->pager->getPerPageSelectBox(5, $numitems-1, 5, true, '%d per > pagina'); > if(DOAJAX){ > $pagercode = > preg_replace('/href="([^"]+)"/', > "href=\"javascript:void(0);\" > onclick=\"ajax_call_list_{$do->__table}('\\1');return false;\"", > $pagercode); $selectBox = preg_replace('/select name/', 'select > onChange="ajax_call_list_' . $do->__table . '(\'?' . > $_SERVER['QUERY_STRING'] . '&' . $do->__table . > 'page=1&' . > $do->__table . 'perPage=\' + this.options[this.selectedIndex].value + > \'&streamtype=AJAX&linkedlist=' . $module . '\');return > false;" name', > $selectBox); > } else { > $selectBox = '<form class="perpage" action="?'. > $_SERVER['QUERY_STRING'].'" method="POST">' > . $selectBox > . '<input type=image name="ok" > src="images/enter.gif">' > . '</form>'; > } > } > > > > -- > Alessandro Pasotti > itOpen - "Open Solutions for the Net Age" > w3: www.itopen.it > Linux User# 167502 -- Alessandro Pasotti itOpen - "Open Solutions for the Net Age" w3: www.itopen.it Linux User# 167502

« previous php.pear.general (#25070) next »