Re: Re: Structures
| From: | Mark Wiesemann | Date: | Mon, 02 Apr 2007 09:51:30 +0000 |
| Subject: | Re: Re: Structures | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-26975@lists.php.net to get a copy of this message | ||
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