const gridRef = grid.getReference();
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);