Re: Can I disable sorting in Structures::Datagrid?
| From: | Olivier Guilyardi | Date: | Sat, 22 Apr 2006 19:45:44 +0000 |
| Subject: | Re: Can I disable sorting in Structures::Datagrid? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23806@lists.php.net to get a copy of this message | ||
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,
--
og
dondo 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.comCc: papercrane@reversefold.com, pear-general@lists.php.netDate: 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