const gridRef = grid.getReference();标签:node,function,const,xsT,gridRef,虚拟,total,添加 From: https://www.cnblogs.com/xsSystem/p/17980490
if (!gridRef) return
grid.getStore().on('beforeload', function (store, records, successful, eOpts) {
grid.getStore().getModel().addFields([
{
name: 'tf_allocateAmount',
type: 'number',
persist: false,
convert: function (value, obj) {
const mainId = grid.ownerId;
const detailVals = obj.data.xsT_cashFlowDetail || obj.data.xsT_invoicesDetail;
let total = 0;
Ext.each(detailVals, rec => {
if (gridRef && rec['tw_ownerId'] === mainId) {/*gridRef==="xsT_cashFlow-payoff-mainHD"*/
total += rec['tf_allocateAmount'];
}
});
return total;
}
}])
}, this, {single: true});
node.align = 'right'
node.renderer = cmd.fMoney
node.summaryRenderer = cmd.fMoney
// node.summaryType= function(records,a,b,c,d) {}
node.summaryType = 'sum'
retCols.push(node);