2019-02-26 14:57 | 题主 | ||||||||
|
关于 groupingsummary的store在手工添加数据时候的group显示问题 在使用 groupingsummary的feature的时候,如果这个结果集合是通过 dataprovider获取的,一切正常;但如果我是在客户端,自己一行一行的添加到 store中的话,那么这个store的group, 会在没添加一行都被触发 从而导致同一个group的每一行都有一个合计, 而不是着整个group一个合计。 如下图,上图是不正常的(通过对第一列排序,会自动变成正常), 下图是期望的汇总结果。 我理解应该是 store.add(row) 触发了汇总 |
2019-02-26 15:54 | #1 | ||||||||
|
另外,我在通过下面代码 清除grid1.store,然后根据条件一个一个add数据,会出现 “Cannot read property 'setAttribute' of undefined” app.grid1.store.removeAll(); if (cycleIds.length === 0 ) { Wb.each(app.statsResultCached, function(row) { app.grid1.store.add(row); }); } else { Wb.each(cycleIds, function(cycleId){ Wb.each(app.statsResultCached, function(row) { if (row.cycle_id == cycleId) { app.grid1.store.add(row); // 貌似这一句导致了 } }); }); } 其中console上的错误信息 wb-debug.js:280 TypeError: Cannot read property 'setAttribute' of undefined at constructor.insert (ext-all-debug.js:113947) at constructor.onReplace (ext-all-debug.js:101714) at constructor.callParent (ext-all-debug.js:4481) at constructor.onReplace (ext-all-debug.js:116514) at constructor.callParent (ext-all-debug.js:4481) at constructor.onReplace (ext-all-debug.js:117121) at constructor.fire (ext-all-debug.js:10254) at constructor.continueFireEvent (ext-all-debug.js:11666) at constructor.fireEventArgs (ext-all-debug.js:11644) at constructor.fireEvent (ext-all-debug.js:11630) 即 insert: function(insertPoint, nodes) { var me = this, elements = me.elements, i, nodeCount = nodes.length; // If not inserting into empty cache, validate, and possibly shuffle. if (me.count) { // Move following nodes forwards by <nodeCount> positions if (insertPoint < me.count) { for (i = me.endIndex + nodeCount; i >= insertPoint + nodeCount; i--) { elements[i] = elements[i - nodeCount]; elements[i].setAttribute('data-recordIndex', i); // 这一行抛出的错误信息 } } me.endIndex = me.endIndex + nodeCount; } |
2019-02-26 16:16 | #2 | ||||||||
|
我把 这一句去掉之后,一切正常。 最终正常运行的代码如下 //app.grid1.store.removeAll(); if (cycleIds.length === 0 ) { app.grid1.store.loadData(app.statsResultCached); } else { var dataToLoad = []; Wb.each(cycleIds, function(cycleId){ Wb.each(app.statsResultCached, function(row) { if (row.cycle_id == cycleId) { dataToLoad.push(row); } }); }); app.grid1.store.loadData(dataToLoad); } |