0

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 Answers1

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.)

MikeTheReader
  • 4,200
  • 3
  • 24
  • 38