RE: [PEAR] Re: Structures

From: Date: Mon, 02 Apr 2007 13:39:12 +0000
Subject: RE: [PEAR] Re: Structures
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26976@lists.php.net to get a copy of this message
Cheers Mark Makes sense I will take a look at that Ian > -----Original Message----- > From: Mark Wiesemann [mailto:wiesemann@php.net] > Sent: 02 April 2007 10:52 > To: Ian Warner > Cc: pear-general@lists.php.net > Subject: Re: [PEAR] Re: Structures > > Hi Ian, > > Ian Warner wrote: > > Mark have I asked this question before ? Apologise for that if I have. > > No, you haven't asked *this* question before. But a similar one that > also could be solved by overloading the renderer. > > > However I cant get the buildRow to output anything. > > The reason is that buildRow() isn't meant to output anything. It builds > a row of a table, but does not output it. > > My suggestion was to do the following: > Create a new class that extends the existing HTMLTable renderer of SDG, > give it a short constructor, copy the buildRow() method from the > renderer and modify this method to your needs. Basically, this should > look like the following: > > class Structures_DataGrid_Renderer_HTMLTableColors > extends Structures_DataGrid_Renderer_HTMLTable > { > function Structures_DataGrid_Renderer_HTMLTableColors() > { > parent::Structures_DataGrid_Renderer_HTMLTable(); > } > function buildRow() > { > // your modifications / additions to the buildRow() > // method of the SDG_R_HTMLTable class as explained > // in my first answer > } > } > > And then, instead of > $result = $datagrid->fill($table); > you would use something like > $result = $datagrid->fill($table, null, 'HTMLTableColors'); > > There is no need to call buildRow() anywhere, SDG does this job for you. > > Regards, > Mark > > -- > http://www.markwiesemann.eu

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