FIX Always show page size dropdown when page size is greater than number of records

This commit is contained in:
Robbie Averill 2017-08-01 16:41:17 +12:00
parent e95c92a168
commit f0d2ec7733
2 changed files with 10 additions and 22 deletions

View File

@ -261,18 +261,6 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
return;
}
// If there is only 1 page for all the records in list, we don't need to go further to sort out those
// first page, last page, pre and next pages, etc we are not render those in to the paginator.
if ($arguments['total-pages'] == 1) {
return ArrayData::create(array(
'OnlyOnePage' => true,
'FirstShownRecord' => $arguments['first-shown'],
'LastShownRecord' => $arguments['last-shown'],
'NumRecords' => $arguments['total-rows'],
'NumPages' => $arguments['total-pages']
));
}
// Define a list of the FormActions that should be generated for pager controls (see getPagerActions())
$controls = array(
'first' => array(
@ -314,7 +302,7 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
// Render in template
return ArrayData::create(array(
'OnlyOnePage' => false,
'OnlyOnePage' => ($arguments['total-pages'] == 1),
'FirstPage' => $actions['first'],
'PreviousPage' => $actions['prev'],
'NextPage' => $actions['next'],

View File

@ -1,15 +1,15 @@
<tr>
<td class="bottom-all" colspan="$Colspan">
<span class="pagination-page-size">
<%t GridFieldConfigurablePaginator.SHOW 'Show' %>
<select name="$PageSizesName" class="pagination-page-size-select" data-skip-autofocus="true">
<% loop $PageSizes %>
<option <% if $Selected %>selected="selected"<% end_if %>>$Size</option>
<% end_loop %>
</select>
$PageSizesSubmit
</span>
<% if not $OnlyOnePage %>
<span class="pagination-page-size">
<%t GridFieldConfigurablePaginator.SHOW 'Show' %>
<select name="$PageSizesName" class="pagination-page-size-select" data-skip-autofocus="true">
<% loop $PageSizes %>
<option <% if $Selected %>selected="selected"<% end_if %>>$Size</option>
<% end_loop %>
</select>
$PageSizesSubmit
</span>
<div class="datagrid-pagination">
$FirstPage $PreviousPage
<span class="pagination-page-number">