RE: [PEAR] Sorting Structures DataGrid using Linked Values fetched via DataObject Linked Vlaues

From: Date: Tue, 14 Aug 2007 23:26:39 +0000
Subject: RE: [PEAR] Sorting Structures DataGrid using Linked Values fetched via DataObject Linked Vlaues
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27818@lists.php.net to get a copy of this message
Hi Mark My bad. Mark Wiesemann wrote: >comment on your code: > >>John Trow-Smith wrote: >>$datagrid->_addDefaultOptions(array( >> 'sort_property' => 'fb_linkOrderFields', >> 'link_property' => 'fb_linkDisplayFields', >> 'link_level' => 1); > >What is $datagrid here? The Structures_DataGrid class doesn't have an >_addDefaultOption() method. The underscore is also indicating that the >method is private, and should not be called by user code. > >Right solutions: >- use the setDataSourceOptions() method of the Structures_DataGrid class >- pass the options in the bind() call >- use the setOptions() of the DataSource class I accidentally took the code snippet from the datasource driver not my user code - I had too many files open for my own good. I think I was following your second suggested option - I'm was actually doing this: $datagridOptions = array( 'link_property' => 'fb_linkDisplayFields', 'link_level' => 1, 'link_keep_key' => true); //bind new DataGrid object to new DataObject and pass any datagridoptions $datagrid->bind($do, $datagridOptions, 'DataObject'); As per Justin's reply, the link integration doesn't actually extend the DataObject so the resulting field isn't sorted by the displayed values. Is there a way to use the $do->getLinks or other DataObject function to make the linked fields available to the $datagrid->addColumn() function? Cheers John

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