Example - Extending the DataGrid --
This example shows you how to extend the DataGrid class to customize it
for your application's needs.
Description
Commonly you will want to use the DataGrid throught your application with
the same look-and-feel and features. You may also want to extend upon the
existing features of the DataGrid to allow for customized functionality.
Below you will see how to extend the DataGrid to allow for this
customizability.
Example
Example 55-1. Extending the class
This example will show you how to extend the DataGrid so you can have the
same look and feel throughout your application.
<?php
require 'Structures/DataGrid.php';
class myDataGrid extends Structures_DataGrid
{
function myDataGrid($limit = null, $page = null)
{
parent::Structures_DataGrid($limit, $page);
// Define DataGrid Color Attributes
$this->renderer->setTableEvenRowAttributes(array('class' => 'evenrow'));
$this->renderer->setTableOddRowAttributes(array('class' => 'oddrow'));
// Define DataGrid Table Attributes
$this->renderer->setTableAttribute('width', '100%');
$this->renderer->setTableAttribute('cellspacing', '1');
$this->renderer->setTableAttribute('cellpadding', '4');
$this->renderer->setTableAttribute('class', 'datagrid');
// Set sorting icons
$this->renderer->sortIconASC = '↑';
$this->renderer->sortIconDESC = '↓';
}
}
?> |
|