Re: Can I disable sorting in Structures::Datagrid?
| From: | Olivier Guilyardi | Date: | Mon, 17 Apr 2006 16:01:54 +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-23683@lists.php.net to get a copy of this message | ||
dondo wrote:
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 {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.
function sort($sortSpec,$sortDir) {
}
}
$datasource = new MyDataSource();
$datasource->bind($yourDBResult);
$datagrid->bindDataSource($datasource);
--
og