Re: Structures_DataGrid_Renderer_Pager: showing the page that contains a given entry

From: Date: Mon, 15 Jan 2007 16:06:28 +0000
Subject: Re: Structures_DataGrid_Renderer_Pager: showing the page that contains a given entry
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26347@lists.php.net to get a copy of this message
On Mon, Jan 15, 2007 at 02:38:52PM +0100, Olivier Guilyardi wrote: > Hi, > > Mark Wiesemann wrote: > >Sylvain Beucler wrote: > >[...] > >>Feasible? :) > >> > >>I'd gladly implement the feature if that's helpful, though I'm not > >>sure Structures_DataGrid is meant for it :/ > > > >Actually I think that SDG is already able to do what you want it to do. > >If I got your idea right, you just need to follow my pointer on the code > >of the PEAR account list page, calculate the right page yourself, and > >pass this value to the SDG constructor. > > Mark, I think the page argument of the SDG constructor is not sufficient > for Sylvain, because he wants to 'show entries "starting with" a given > one'. Example: display 10 rows per page, the B letter starts at row 15 ; > with the page argument he can only starts from a multiple of 10. > > So IMO, Sylvain you should simply bypass SDG page handling : > > $datagrid = new Structures_DataGrid(); > $start = <compute at which row you want to start> > $datagrid->bind("SELECT foo FROM bar LIMIT $start, 10"); > > And don't use the default Pager renderer, write your own "letter" driver. Yeah, that's the main problem: computing the appropriate page means I have to recompute what SDG does, taking into account the sort field, sort order and pager size, which I think SDG should do. I don't so much look for how to program it than how to have my data-display lib do it automagically. Given the versatile nature of SDG I wondered if that value->page# mapping is a wanted feature - I think getting the positionning for a SQL query needs non-trivial rewriting (self-join) or inefficient full-length prescanning; moreover other structures SDG reads from might just not be suitable. On the other hand this would be a nifty addition. If I understand well this is not a wanted feature and users should just manually precompute and set the appropriate page. Too bad! -- Sylvain

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