mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
NEW: Make the record count in GridFieldFooter optional
This commit is contained in:
parent
b15b93630c
commit
d7eb2757fe
@ -21,15 +21,17 @@ class GridFieldFooter implements GridField_HTMLProvider {
|
|||||||
* @var string - a message to display in the footer
|
* @var string - a message to display in the footer
|
||||||
*/
|
*/
|
||||||
protected $message = null;
|
protected $message = null;
|
||||||
|
protected $showrecordcount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $message - a message to display in the footer
|
* @param string $message - a message to display in the footer
|
||||||
*/
|
*/
|
||||||
public function __construct($message = null) {
|
public function __construct($message = null, $showrecordcount = true) {
|
||||||
if($message) {
|
if($message) {
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
}
|
}
|
||||||
|
$this->showrecordcount = $showrecordcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ class GridFieldFooter implements GridField_HTMLProvider {
|
|||||||
$count = $gridField->getList()->count();
|
$count = $gridField->getList()->count();
|
||||||
|
|
||||||
$forTemplate = new ArrayData(array(
|
$forTemplate = new ArrayData(array(
|
||||||
|
'ShowRecordCount' => $this->showrecordcount,
|
||||||
'Message' => $this->message,
|
'Message' => $this->message,
|
||||||
'FirstShownRecord' => 1,
|
'FirstShownRecord' => 1,
|
||||||
'LastShownRecord' => $count,
|
'LastShownRecord' => $count,
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="bottom-all" colspan="$Colspan">
|
<td class="bottom-all" colspan="$Colspan">
|
||||||
<span class="pagination-records-number">
|
<% if $ShowRecordCount %>
|
||||||
$FirstShownRecord -
|
<span class="pagination-records-number">
|
||||||
$LastShownRecord
|
$FirstShownRecord -
|
||||||
<% _t('TableListField_PageControls_ss.OF', 'of', 'Example: View 1 of 2') %>
|
$LastShownRecord
|
||||||
$NumRecords
|
<% _t('TableListField_PageControls_ss.OF', 'of', 'Example: View 1 of 2') %>
|
||||||
</span>
|
$NumRecords
|
||||||
|
</span>
|
||||||
|
<% end_if %>
|
||||||
<% if $Message %>
|
<% if $Message %>
|
||||||
<div class="datagrid-footer-message">$Message</div>
|
<div class="datagrid-footer-message">$Message</div>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
Loading…
Reference in New Issue
Block a user