Structures_DataGrid_Renderer_Pager: showing the page that contains a given entry
| From: | Sylvain Beucler | Date: | Mon, 08 Jan 2007 21:51:48 +0000 |
| Subject: | Structures_DataGrid_Renderer_Pager: showing the page that contains a given entry | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-26293@lists.php.net to get a copy of this message | ||
Hi,
I'd like to do use Structures_DataGrid to show a list of data entries,
with a Pager to show those entries split on several pages, and be able
to select a page by saying "show me the page that contains data X".
Sample use cases: you show a list of users (thousands of users) using
Structures_DataGrid, and with the Pager renderer, 20 users per page.
- when you click on a user, you go to the user's edition page, and
there, the same Structures_DataGrid array shows the page that
contains the user you're editing (instead of getting back to the
first page).
- show entries "starting with" a given one. E.g.: there's a search box
in the users list page where you can type a username's first letter
in. If you type 'B', then you show the list of users starting with
'B', but then also the users starting with 'C' if there's still room
for it, then 'D', etc. I mean: do not just restrict the data input
to users starting with 'B' - if there's only 1 such users a
one-liner array will look a bit weird.
For SQL, I guess this would require a quick query to know the position
of a given element according to the current sorting constraints
(SELECT COUNT(*) FROM my_users_table WHERE login_name < 'B' ORDER BY
login_name DESC...) and adapt the LIMIT accordingly.
Is there a way to do that with Structures_DataGrid? Otherwise, could
this make a feature request, or is the package architecture just not
meant for that?
Thanks,
--
Sylvain