Permalink
Browse files

MINOR Don't show GridField pagination when no records are found, and …

…ensure the "no results" message is laid out correctly
  • Loading branch information...
chillu committed Mar 8, 2012
1 parent 174cf08 commit b321b9b99551ff7c412c2d8f3dace356a0a69cff
Showing with 3 additions and 1 deletion.
  1. +1 −1 forms/gridfield/GridField.php
  2. +2 −0 forms/gridfield/GridFieldPaginator.php
@@ -358,7 +358,7 @@ public function FieldHolder() {
$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;
}
@@ -87,6 +87,8 @@ public function getHTMLFragments($gridField) {
// 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;

0 comments on commit b321b9b

Please sign in to comment.