mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FEATURE Add title component
This commit is contained in:
parent
23af60633c
commit
38bce79fc6
@ -79,8 +79,6 @@ class GridField extends FormField {
|
|||||||
*/
|
*/
|
||||||
public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) {
|
public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) {
|
||||||
parent::__construct($name, $title, null);
|
parent::__construct($name, $title, null);
|
||||||
|
|
||||||
FormField::__construct($name);
|
|
||||||
|
|
||||||
if($dataList) {
|
if($dataList) {
|
||||||
$this->setList($dataList);
|
$this->setList($dataList);
|
||||||
|
@ -84,6 +84,7 @@ class GridFieldConfig_Base extends GridFieldConfig {
|
|||||||
* @param int $itemsPerPage - How many items per page should show up
|
* @param int $itemsPerPage - How many items per page should show up
|
||||||
*/
|
*/
|
||||||
public function __construct($itemsPerPage=25) {
|
public function __construct($itemsPerPage=25) {
|
||||||
|
$this->addComponent(new GridFieldTitle());
|
||||||
$this->addComponent(new GridFieldSortableHeader());
|
$this->addComponent(new GridFieldSortableHeader());
|
||||||
$this->addComponent(new GridFieldFilter());
|
$this->addComponent(new GridFieldFilter());
|
||||||
$this->addComponent(new GridFieldDefaultColumns());
|
$this->addComponent(new GridFieldDefaultColumns());
|
||||||
|
11
forms/gridfield/GridFieldTitle.php
Normal file
11
forms/gridfield/GridFieldTitle.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class GridFieldTitle implements GridField_HTMLProvider {
|
||||||
|
function getHTMLFragments($gridField) {
|
||||||
|
return array(
|
||||||
|
'header' => $gridField->renderWith('GridFieldTitle')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
3
templates/Includes/GridFieldTitle.ss
Normal file
3
templates/Includes/GridFieldTitle.ss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<tr class="title">
|
||||||
|
<th colspan="$ColumnCount">$Title</th>
|
||||||
|
</tr>
|
Loading…
Reference in New Issue
Block a user