Re: Re: Datagrid

From: Date: Tue, 19 Sep 2006 23:15:35 +0000
Subject: Re: Re: Datagrid
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25176@lists.php.net to get a copy of this message
On 9/19/06, Mark Wiesemann <wiesemann@php.net> wrote:
Chris Boget wrote: Datagrid is described as a "Datasource driver using PEAR::DB_DataObject".
No, that's the description for Structures_DataGrid_DataSource_DBDataObject. Structures_DataGrid is the actual DataGrid package.
I've run the createTables.php script to create interface classes to my MySQL tables, all of which are child classes of DB_DataObject. Is there any way to 'merge' the two together such that your Structures_DataGrid() object uses my table interface object? Currently my code looks like this: $datagrid = new Structures_DataGrid(); $result = $datagrid->bind( 'SELECT * FROM MyTable' ); echo $datagrid->getOutput( DATAGRID_RENDER_XML ); and that pretty much does what I want (in a very simplistic way). Is there any way that I can bind my table interface object to the datagrid (or vice versa) such that the result set datagrid uses is whatever is returned from one of my interface object's (custom) methods? I'm not sure whether I get your question right, but bind() accepts various types of inputs. One type is a query string (like in your example), another one is a DB_DataObject instance (which seems to be what you want to have). You can find more information about SDG & DBDO in a tutorial from Olivier: http://www.samalyse.com/code/pear/dgdo/
As Mark says, just bind a DataObject instance and your datagrid will use DB_DO. -- Justin Patrin

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