PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Structures » Structures_DataGrid » Bug #6607

Support for table caption in table renderer

Details

Request #6607Support for table caption in table renderer
Submitted2006-01-27 15:47 UTC
Fromponcho at zoom dot co dot uk
Assignedolivierg
StatusClosed
PackageStructures_DataGrid
PHP VersionIrrelevant
OSAll
Roadmaps(Not assigned)

Comments

[2006-01-27 15:47 UTC] poncho at zoom dot co dot uk

Description:
------------
Is there any possibility of adding support for a table
caption in Structures_DataGrid_Renderer_HTMLTable?

I've hacked a function in there in the meantime to call the
setCaption method of HTML_Table.

/**
* Set table caption
*
* @access public
* @param string $value The caption to use for the
table.
* @param array $attr The attributes for the table
caption.
*/
function setTableCaption($value, $attr = null)
{
$this->_table->setCaption($value, $attr);
}

Test script:
---------------
/* Get a reference to the Renderer object */
$renderer =& $dg->getRenderer();

// Set table Caption
$caption = ($renderer->getPaging()) ? $renderer->getPaging() : 'No more pages to display';
$renderer->setTableCaption($caption, array('align' => 'top', 'style' => 'text-align: left;'));

[2006-01-27 16:36 UTC] olivierg at php dot net

The new CVS code allows to attach a customized HTMLTable object :

$table = new HTML_Table ();
$table->setCaption('Fruits');
$datagrid->renderInto ($table);
$datagrid->render();

The above code is tested and works fine with the current CVS. However we are in the process of refactoring the renderers so that this behaviour may change, and the renderInto() method may be renamed. Although it works, the current CVS has to be considered unstable.