John Glabb
John Glabb

Reputation: 1621

dojo treeGrid aggregate not working after refreshing jsonStore

I have dojo treeGrid that shows totals for child items. Everything works fine. But if I replace/update store and refresh then aggregation doesn't work and all totals shown as NaN. What am I doing wrong?

var layout = [ 
    { cells: [ 
       [ {field: "userName", name: "Name"}, 
         {field: "childItems", 
           children: [ { field: "debit", name: "debit"},
                       { field: "credit", name: "credit"}  
                     ], 
                  aggregate: "sum" 
                  } 
                  ]] } ]

var jsonStore = new dojo.data.ItemFileWriteStore({ url: "<............>"});


var grid = new dojox.grid.TreeGrid({ 
    structure: layout, 
    store: jsonStore, 
    query: {type: 'year'}, 
    queryOptions: {deep: true},
    rowSelector: true, 
    openAtLevels: [false],
    autoWidth: true,
    autoHeight: true
    }, 
    dojo.byId("treeGrid"));

//replace store button
var button = dojo.query("[id$=':buttonReplace']")[0];
dojo.on(button,'click',
    function(e){ 
        grid.store.close();
        grid.store = new dojo.data.ItemFileWriteStore({ url: "<... new store url...>"});    
        grid._refresh();
    }
);  

grid.startup();
dojo.connect(window, "onresize", grid, "resize");

Upvotes: 0

Views: 129

Answers (0)

Related Questions