Sonata Admin + 在列表视图中显示所有项目(不是每页) [英] Sonata Admin + show all items on list view (not per page)
问题描述
在
问题是我不知道如何做到这一点.有人可以帮我带路吗?
在 SonataAdmin 3.x 中要默认所有行,您需要执行以下操作:
1 - 将 _per_page = All 添加到 $datagridValues
:
protected $datagridValues = array('_sort_order' =>'ASC',...'_per_page' =>'全部',);
2 - 全部添加到 $perPageOptions:
protected $perPageOptions = [16, 32, 64, 128, 192, 'All'];
3 - 将 $maxPerPage 设置为 All:
protected $maxPerPage = 'All';
In the Sonata Admin Bundle you have a list view where you can add fields you want to show in your table.
At the bottom of the table you have the number of results and pagination. I like the pagination and items per page. But I would like to show ALL the items at the load of the page. So all the items are shown on the page but you can still choose to decrease the number of results per page.
The problem is I don't have a clue on how to do this. Can someone set me on my way?
In SonataAdmin 3.x to have all rows by default you need to do the following :
1 - Add _per_page = All to $datagridValues
:
protected $datagridValues = array(
'_sort_order' => 'ASC',
...
'_per_page' => 'All',
);
2 - Add All to $perPageOptions:
protected $perPageOptions = [16, 32, 64, 128, 192, 'All'];
3 - Set $maxPerPage to All:
protected $maxPerPage = 'All';
这篇关于Sonata Admin + 在列表视图中显示所有项目(不是每页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!