Default sorting the Dojo DataGrid
Posted: March 3rd, 2009 | Author: Joakim Andersson | Filed under: javascript | Tags: dojo, javascript | 5 Comments »This is how I have configure default sorting for our grids:
dojo.declare("DefaultSortableGrid", dojox.grid.DataGrid, {
sortInfo: 1 // the index (1-based) of the column
// to sort, + => asc, - => desc
});
And then I use DefaultSortableGrid when defining the grid:
<div dojoType="DefaultSortableGrid"
id="grid"
rowsPerPage="50">
</div>
Pretty simple really.
Thanks, this got me on the right track!
You can also change your grid declaration to do the sorting:
With a code tag this time
With a code tag this time
\ \With a code tag this time
DIVSTART dojoType="dojox.grid.DataGrid" id="grid" rowsPerPage="50" sortInfo=3> DIVENDGreat! I was actually looking for a way to do it declaratively but ran out of patience when I didn’t find anything on google so did it programatically instead.