Re: Can I disable sorting in Structures::Datagrid?
| From: | dondo | Date: | Sat, 22 Apr 2006 20:41:06 +0000 |
| Subject: | Re: Can I disable sorting in Structures::Datagrid? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23807@lists.php.net to get a copy of this message | ||
Awesome, I'll give it a try. Another feature that would be nice (and it might already be
possible) is the ability to easily override the default sort direction for each column. I'll do
this in the custom header of course, but it might be a feature to consider. While I'm at it,
I'll suggest another feature.. the ability to specify a "then by" column to sort by.
I.e, the equivalent of ORDER BY columnA, columnB in SQL. I haven't dug into the DataGrid code
enough to see how everything works, so perhaps I have just missed a currently existing way to do
this or maybe it would be too difficult or outside the scope of the project. Anyway, it's a
great library as it is and I really like using it.. it's lightning fast for one thing.
Thanks,
Bryan
--- On Sat 04/22, Olivier Guilyardi < ojaiml@nerim.net > wrote:
From: Olivier Guilyardi [mailto: ojaiml@nerim.net]
To: dondo@myway.com
Cc: pear-general@lists.php.net
Date: Sat, 22 Apr 2006 21:45:44 +0200
Subject: Re: [PEAR] Can I disable sorting in Structures::Datagrid?
Hi Bryan,We have rewritten most of the rendering layer. It should be much easier for you to create a
custom header with the current CVS :- subclass Structures_DataGrid_Renderer_HTMLTable- overload
Structures_DataGrid_Renderer_HTMLTable::buildHeader()- attach your custom renderer with
Structures_DataGrid::attachRenderer()We always test before comitting so you shouldn't have much
trouble using the CVS.We should be releasing 0.7 in the next weeks.Regards,-- ogdondo wrote:>
Thanks Olivier. Unfortunately this didn't work for me. I think the only way is to write my
own table heading code.> > regards,> Bryan> > --- On Mon 04/17, Olivier Guilyardi
< ojaiml@nerim.net > wrote:> From: Olivier Guilyardi [mailto: ojaiml@nerim.net]> To:
dondo@myway.com> Cc: papercrane@reversefold.com, pear-general@lists.php.net> Date: Mon,
17 Apr 2006 18:01:54 +0200> Subject: Re: [PEAR] Can I disable sorting in
Structures::Datagrid?> > dondo wrote:>>If you're setting an orderBy request
parameter
then that is >yourproblem. SDG will use that parameter to automatically sort. Try >using
another name for it.> > > I thought about doing that, but didn't want to disable the
headings. It appears I have to write my own header code to get this to work the way I want it to.
Ideally there would be a method that could override the automatic sorting so that the table headers
didn't get disabled. One of the reasons I wanted to use DataGrid was to avoid having to write
the header code. > I think that the best way to do what you want (disable sorting but keep
links) is to subclass the datasource driver and overload sort() with an empty method.Example:class
MyDataSource extends Structures_DataGrid_DataSource_DB{ function sort($sortSpec,$sortDir) {
}}$datasource = new
MyDataSource();$datasource->bind($yourDBResult);$datagrid->bindDataSource($datasource);--
og> > _______________________________________________> No banners. No pop-ups. No
kidding.> Make My Way your home on
the Web - http://www.myway.com> -- PEAR General Mailing List
(http://pear.php.net/)To unsubscribe, visit: http://www.php.net/unsub.php
_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way your home on the Web - http://www.myway.com