views:

93

answers:

3

I am trying to create an Enhanced Grid with nested sorting functionality in Dojo but when I go to add the nested sorting functionality via the plugins the grid no longer works (shows up) in the page. My enhanced grid creation code is as follows:

dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojox.grid.enhanced.plugins.NestedSorting");
grid = new dojox.grid.EnhancedGrid({
        canSort: function(colIndex) {
            //colIndex = -colIndex; //make columns decend 
            if ((colIndex == colA) || (colIndex == colB)) {
                return false;
            }
            return true;
        },
        onHeaderCellMouseOver:function(event{onGridHeaderCellMouseOver(event,layout[0]);},
        onHeaderCellMouseOut: function(event){onGridHeaderCellMouseOut(event,layout[0]);},
        store: msgStore,
        structure: layout,
        plugins: {nestedSorting: true}
    },document.createElement("div"));
    dojo.byId("TableHolder").appendChild(grid.domNode);
    grid.startup();
    grid.setSortInfo(-1);

If I comment out the plugins line then it will work perfectly w/o nested sort. Does anyone know how I would be able to get nested sorting functionality? I am using Dojo 1.4. Thanks

A: 

Just had a quick try with 1.4.3, seems the same code works for me:

dojo.addOnLoad(function(){
    var grid = new dojox.grid.EnhancedGrid({
        id:'grid',
        canSort: function(colIndex) {
            if ((colIndex == 0) || (colIndex == 1)) {
                return false;
            }
            return true;
         },
         onHeaderCellMouseOver:function(event)onGridHeaderCellMouseOver(event,layout[0]);},
        onHeaderCellMouseOut: function(event)onGridHeaderCellMouseOut(event,layout[0]);},
        store: csvStore1,
        structure: layout,
        plugins : {nestedSorting: true}
    }, document.createElement("div"));
    dojo.byId("gridDiv").appendChild(grid.domNode);
    grid.startup();
    grid.setSortInfo(-1);  });

it's malformed in your onHeaderCellMouseOver:function(event{, but don't think that's the cause since single sort works for you.

BTW, setting default nested sorting order by grid.setSortInfo(-1) aren't supported in 1.4(it's in plan for 1.6)

Evan
+2  A: 

Seems like I have solved this issue .... I figured out that a file that must be included 'required' is: "dojox.grid.cells.dijit". Weird thing is that I found no indication that this was necessary from the documentation, but did happen to find it in the examples. Once this was added to my required statements I had nested sorting. Could someone explain this specific require and its seemingly crucial importance?

Thanks

Traker
@Traker You might want to add your dojo.require findings and the "Could someone explain the requirement..." as an edit to your question. It would give a bit more visibility to your solution and the follow up question. Cheers. (P.S. +1 for anything that clarifies Dojo Documentation.)
S.Jones
A: 

Should be a defect in earlier version, it's working for me in 1.5, also a related thread at dojo forum

Evan