Default sorting the Dojo DataGrid

Posted: March 3rd, 2009 | Author: | Filed under: javascript | Tags: , | 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.


5 Comments on “Default sorting the Dojo DataGrid”

  1. 1 Brendan Billingsley said at 23:18 on March 4th, 2009:

    Thanks, this got me on the right track!

    You can also change your grid declaration to do the sorting:

  2. 2 Brendan Billingsley said at 23:21 on March 4th, 2009:

    With a code tag this time

  3. 3 Brendan Billingsley said at 23:22 on March 4th, 2009:

    With a code tag this time

    \ \

  4. 4 Brendan Billingsley said at 23:22 on March 4th, 2009:

    With a code tag this time

    DIVSTART dojoType="dojox.grid.DataGrid" id="grid" rowsPerPage="50" sortInfo=3> DIVEND

  5. 5 Joakim said at 23:53 on March 4th, 2009:

    Great! 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.


Leave a Reply

  • Receive notifications via email of new comments on this post