添加虚拟列

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);
posted on 2024-01-22 17:06  xsSystem  阅读(4)  评论(0编辑  收藏  举报