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(
'tr',
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;
}

View File

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