DataGrid's rowsPerPage attribute not working

旧城冷巷雨未停 提交于 2019-12-25 02:19:04

问题


I need to add pagination feature to few of my DataGrids and I am just moving ahead step by step. To begin with I tried setting 'rowsPerPage' attribute of DataGrid to some value, say 5. But it has no impact on the displayed grid. I mean number of rows displayed are more than the value set to 'rowsPerPage'.

     <table dojoType="dojox.grid.DataGrid" store="tags" rowsPerPage =3 
   style="width: 100%; height: 500px;">
    <thead>
        <tr>
            <th width="150px" field="dept">Namey</th>
            <th width="150px" field="name">Depty</th>
                    </tr>
    </thead>
</table>

Please tell me how to show only 3 results only per time .

I have been searching web since morning but to no avail. Any inputs will be highly appreciated.

Please help .


回答1:


The rowsPerPage property actually doesn't control the number of items show in the grid. It controls the number of rows loaded as you scroll through the grid. Default is 25, and that's usually pretty good.

What you want to do is set the autoHeight property on the grid to the number of rows you want to show. It's kind of an interesting property because it can be set to "true" which will expand your grid to show all data rows, or it can be set to a number (like 3) and then it will only show that many rows, and create a scroller for your grid if your data store has more than that number of rows.

(I know this is probably a late answer, but found this while researching another grid question, and thought I'd throw it out there.)



来源:https://stackoverflow.com/questions/6791157/datagrids-rowsperpage-attribute-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!