Home > Archive > PHP Pear > April 2006 > Re: [PEAR] Can I disable sorting in Structures::Datagrid?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PEAR] Can I disable sorting in Structures::Datagrid?
|
|
|
|
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 con
sider. 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 h
ave 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()- att
ach 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 w s.Regards,-- ogdondo wrote:> Thanks Olivier. Unfortunately th
is 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: p
apercrane@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) { }}$dat
asource = 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
| |
| Olivier Guilyardi 2006-04-22, 7:00 pm |
| dondo wrote:
> 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.
There is a new method : Structures_DataGrid::setDefaultSort()
It allows to specify how the DataGrid must be sorted when it is first seen by
the user.
But it seems like you want to specify the default sort for _each_ column, like
ASC for column1, DESC for column2, etc...
I believe we'll never provide options for such a specific need. The danger
always is that the package may get bloated with options, specific methods, etc...
But we have tried to make customizing or writing rendering driver from scratch
as easy as possible, because we realized that's the only way to answer the wide
variety of needs that we observe. I'm currently writing a HOWTO about this, that
will be included in the end-user manual.
> 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.
That's what we call the "multiSort" feature.
> 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.
We are in the process of implementing multiSort. The renderer and datasource
core layers support it, as well as the DB_DataObject datasource driver. However,
there is no rendering drivers that support multiSort, and the core controller
(Structures_DataGrid class) is not ready for it.
It's not very hard, but not easy either. We're trying to do things as clean as
possible and that takes time...
> Anyway it's a great library as it is and I really like using it.. it's
> lightning fast for one thing.
Thanks !
--
og
|
|
|
|
|