Set datagrid to show just 5 rows per page

2019-07-21 08:05发布

I am using DOJO for data grid presentation

 <div id="grid_log" dojoType="dojox.grid.DataGrid" store="log"   structure="window.layout_log" queryOptions="{deep:true}" query="{}" clientSort="true" rowsPerPage="5"> </div>

but problem is that grid_log doesn't show just 5 rows per page. What is wrong with this tag ? Why ignores rowsPerPage="5" ?

2条回答
在下西门庆
2楼-- · 2019-07-21 08:44

It's look like the rowsPerPage value isn't pages that are "viewed" - but rather, "virtual" pages. That is, the grid only renders portions of itself at a time (in order to improve performance for very large data sets) - and the rowsPerPage value is used to determine how many rows to render at a time.

If you scroll to a position on the grid that it outside the rendered pages, it will render it on demand.

If you are displaying more than 5 rows (due to the height that you have set on your grid) - then setting rowsPerPage to 5 will just cause the viewable portion to be rendered in batches of 5 rows at a time. i.e. there will be a query called to your datastore with start=0 and count=5, and another query sent with start=5 and count=5, etc - until all the visible rows are rendered.

However you can see on this page - it is example of grid with paging. May be it helps you.

查看更多
我只想做你的唯一
3楼-- · 2019-07-21 08:49

As far as new dojo is concerned dojo 1.7.2 here you have the pagination feature where in the pages can be set for the enhanced datagrid.If that is what you want that you will have to import the pagination plugin from new dojo and set it in the grid.You can set the pages in the grid

查看更多
登录 后发表回答