NEW: Make the record count in GridFieldFooter optional

This commit is contained in:
Jeremy Shipman 2014-11-13 13:48:02 +13:00
parent b15b93630c
commit d7eb2757fe
2 changed files with 12 additions and 8 deletions

View File

@ -21,15 +21,17 @@ class GridFieldFooter implements GridField_HTMLProvider {
* @var string - a message to display in the footer
*/
protected $message = null;
protected $showrecordcount;
/**
*
* @param string $message - a message to display in the footer
*/
public function __construct($message = null) {
public function __construct($message = null, $showrecordcount = true) {
if($message) {
$this->message = $message;
}
$this->showrecordcount = $showrecordcount;
}
@ -37,6 +39,7 @@ class GridFieldFooter implements GridField_HTMLProvider {
$count = $gridField->getList()->count();
$forTemplate = new ArrayData(array(
'ShowRecordCount' => $this->showrecordcount,
'Message' => $this->message,
'FirstShownRecord' => 1,
'LastShownRecord' => $count,

View File

@ -1,12 +1,13 @@
<tr>
<td class="bottom-all" colspan="$Colspan">
<span class="pagination-records-number">
$FirstShownRecord -
$LastShownRecord
<% _t('TableListField_PageControls_ss.OF', 'of', 'Example: View 1 of 2') %>
$NumRecords
</span>
<% if $ShowRecordCount %>
<span class="pagination-records-number">
$FirstShownRecord -
$LastShownRecord
<% _t('TableListField_PageControls_ss.OF', 'of', 'Example: View 1 of 2') %>
$NumRecords
</span>
<% end_if %>
<% if $Message %>
<div class="datagrid-footer-message">$Message</div>
<% end_if %>