mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Fix a couple of rebasing-related bugs in GridField.
This commit is contained in:
parent
f9323b398c
commit
ed0e06c0f6
@ -380,22 +380,9 @@ class GridField extends FormField {
|
||||
"but not defined. Perhaps there is a supporting GridField component you need to add?");
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
foreach($list as $idx => $record) {
|
||||
$rowContent = '';
|
||||
foreach($columns as $column) {
|
||||
$colContent = $this->getColumnContent($record, $column);
|
||||
// A return value of null means this columns should be skipped altogether.
|
||||
if($colContent === null) continue;
|
||||
$colAttributes = $this->getColumnAttributes($record, $column);
|
||||
$rowContent .= $this->createTag('td', $colAttributes, $colContent);
|
||||
}
|
||||
$rows[] = $row;
|
||||
}
|
||||
$content['body'] = implode("\n", $rows);
|
||||
|
||||
$total = $list->count();
|
||||
if($total > 0) {
|
||||
$rows = array();
|
||||
foreach($list as $idx => $record) {
|
||||
$rowContent = '';
|
||||
foreach($columns as $column) {
|
||||
@ -419,10 +406,12 @@ class GridField extends FormField {
|
||||
),
|
||||
$rowContent
|
||||
);
|
||||
$content['body'][] = $row;
|
||||
$rows[] = $row;
|
||||
}
|
||||
$content['body'] = implode("\n", $rows);
|
||||
|
||||
} else { //display a message when the grid field is empty
|
||||
$row = $this->createTag(
|
||||
$content['body'] = $this->createTag(
|
||||
'tr',
|
||||
array("class" => 'ss-gridfield-item ss-gridfield-no-items'),
|
||||
$this->createTag('td', array('colspan' => count($columns)), _t('GridField.NoItemsFound', 'No items found'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user