Example - Extending the DataGrid --
This example shows you how to extend the DataGrid class to customize it
for your application's needs.
ïÐÉÓÁÎÉÅ
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.
ðÒÉÍÅÒ
Пример 53-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 = 0)
{
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
$dg->renderer->sortIconASC = '↑';
$dg->renderer->sortIconDESC = '↓';
}
}
?> |
|