MINOR Don't show GridField pagination when no records are found, and ensure the "no results" message is laid out correctly

This commit is contained in:
Ingo Schommer 2012-03-08 17:51:03 +01:00
parent 174cf08c75
commit b321b9b995
2 changed files with 3 additions and 1 deletions

View File

@ -358,7 +358,7 @@ class GridField extends FormField {
$row = $this->createTag( $row = $this->createTag(
'tr', 'tr',
array("class" => 'ss-gridfield-item ss-gridfield-no-items'), array("class" => 'ss-gridfield-item ss-gridfield-no-items'),
$this->createTag('td', array(), _t('GridField.NoItemsFound', 'No items found')) $this->createTag('td', array('colspan' => count($columns)), _t('GridField.NoItemsFound', 'No items found'))
); );
$content['body'][] = $row; $content['body'][] = $row;
} }

View File

@ -87,6 +87,8 @@ class GridFieldPaginator implements GridField_HTMLProvider, GridField_DataManipu
// Figure out which page and record range we're on // Figure out which page and record range we're on
$countList = clone $gridField->List; $countList = clone $gridField->List;
$totalRows = $countList->limit(null)->count(); $totalRows = $countList->limit(null)->count();
if(!$totalRows) return array();
$totalPages = ceil($totalRows/$this->itemsPerPage); $totalPages = ceil($totalRows/$this->itemsPerPage);
if($totalPages == 0) if($totalPages == 0)
$totalPages = 1; $totalPages = 1;