mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
FIX Always show page size dropdown when page size is greater than number of records
This commit is contained in:
parent
e95c92a168
commit
f0d2ec7733
@ -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'],
|
||||
|
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user