Re: DataObject datasource for DataGrid

From: Date: Mon, 10 Jan 2005 15:58:31 +0000
Subject: Re: DataObject datasource for DataGrid
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16859@lists.php.net to get a copy of this message
Please answer on the mailing-list. No, bind() is where to pass the options. So, either : $datagrid->bind($dataobject,$options); Or : require_once 'Structures/DataGrid/DataSource/DataObject.php'; $source =& new Structures_DataGrid_DataSource_DataObject(); $source->bind($dataobject,$options); $datagrid->bindDataSource($source); The first method only works with built-in drivers (dataobject, xml, etc...). The second one will work with any drivers, including those that you may write by yourself. That is the reason why bindDataSource() exists : custom drivers. -- og electroteque wrote: > like this ? > > $options2 = array('generate_columns' => true,'fields' => > array('username', 'realname')); > $dg->bindDataSource($data,$options2); > > On 10/01/2005, at 9:10 PM, Olivier Guilyardi wrote: > >> electroteque wrote: >> >>> Hi , I have discovered a huge problem with the DataObject datasource >>> for DataGrid, one being that some bug for the toArray method is not >>> fixed so its returning all the object vars and using them as the >>> columns ! >> >> >> Have you tried passing the "fields" option ? This will specify which >> columns >> you want displayed. As in : >> >> $options = array( >> 'generate_columns' => true, >> 'fields' => array('col1', 'col2', 'col3',...), >> ); >> >> $datagrid->bind ($dataobject, $options); >> >> -- >> og >> >> -- >> PEAR General Mailing List (http://pear.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >

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