Re: Pear pager getPerPageSelectBox
| From: | Alessandro Pasotti | Date: | Tue, 05 Sep 2006 10:53:40 +0000 |
| Subject: | Re: Pear pager getPerPageSelectBox | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25068@lists.php.net to get a copy of this message | ||
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 = ' ' .
$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