diff --git a/forms/TableListField.php b/forms/TableListField.php index a38374c71..38e72980e 100755 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -76,6 +76,11 @@ class TableListField extends FormField { */ protected $template = "TableListField"; + /** + * @var $itemClass string Class name for each item/row + */ + public $itemClass = 'TableListField_Item'; + /** * @var bool Do we use checkboxes to mark records, or delete them one by one? */ @@ -467,8 +472,7 @@ JS function Items() { $fieldItems = new DataObjectSet(); if($items = $this->sourceItems()) foreach($items as $item) { - $fieldItem = new TableListField_Item($item, $this); - if($item) $fieldItems->push(new TableListField_Item($item, $this)); + if($item) $fieldItems->push(new $this->itemClass($item, $this)); } return $fieldItems; } @@ -670,7 +674,7 @@ JS foreach($groupedItems as $key => $group) { $fieldItems = new DataObjectSet(); foreach($group as $item) { - if($item) $fieldItems->push(new TableListField_Item($item, $this)); + if($item) $fieldItems->push(new $this->itemClass($item, $this)); } $groupedArrItems->push(new ArrayData(array( 'Items' => $fieldItems, @@ -953,7 +957,7 @@ JS $className = isset($item['RecordClassName']) ? $item['RecordClassName'] : $item['ClassName']; $item = new $className($item); } - $fieldItem = new TableListField_Item($item, $this); + $fieldItem = new $this->itemClass($item, $this); $fields = $fieldItem->Fields(false); $columnData = array();