FEATURE Add title component

This commit is contained in:
Andrew O'Neil 2012-02-09 16:02:47 +13:00
parent 23af60633c
commit 38bce79fc6
4 changed files with 15 additions and 2 deletions

View File

@ -79,8 +79,6 @@ class GridField extends FormField {
*/
public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) {
parent::__construct($name, $title, null);
FormField::__construct($name);
if($dataList) {
$this->setList($dataList);

View File

@ -84,6 +84,7 @@ class GridFieldConfig_Base extends GridFieldConfig {
* @param int $itemsPerPage - How many items per page should show up
*/
public function __construct($itemsPerPage=25) {
$this->addComponent(new GridFieldTitle());
$this->addComponent(new GridFieldSortableHeader());
$this->addComponent(new GridFieldFilter());
$this->addComponent(new GridFieldDefaultColumns());

View File

@ -0,0 +1,11 @@
<?php
class GridFieldTitle implements GridField_HTMLProvider {
function getHTMLFragments($gridField) {
return array(
'header' => $gridField->renderWith('GridFieldTitle')
);
}
}
?>

View File

@ -0,0 +1,3 @@
<tr class="title">
<th colspan="$ColumnCount">$Title</th>
</tr>