dojo treeGrid aggregate not working after refreshing jsonStore

懵懂的女人 提交于 2019-12-25 02:13:09

问题


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");

来源:https://stackoverflow.com/questions/51130123/dojo-treegrid-aggregate-not-working-after-refreshing-jsonstore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!