如何计算商店中一个字段的总数

mag*_*gut 4 grid extjs extjs4

我在表格中有一个网格,如所附的图像。更改客户名称后,将为网格存储加载与该客户相对应的记录。我希望用“应付金额”列的总和来填充余额文本字段。

图片在 这里

Had*_*das 5

像这样使用:

store.load({
    scope   : this,
    callback: function(records, operation, success) {
        //here the store has been loaded so you can use what functions you like.
        //This code sum numbers in certain column
        sum = 0; 
        store.each(function (rec) { sum += rec.get('NameColumn'); });
    }
});
Run Code Online (Sandbox Code Playgroud)