Ext中Store数据的操作【添加统计行】

var deletelist="";

var addauthlist="";

var addeditlist="";

var adddownloadlist="";

 

var rowCount = Ext.getCmp("authgrid").store.getCount();

for (var i = 0;i < rowCount; i++) {

var record = Ext.getCmp('authgrid').getStore().getAt(i);

//删除

if (record.data.auth == '0' && record.data.authid != ""){

deletelist +=record.data.authid + ',';

} if (record.data.edit == '0'&& record.data.editid != "") {

deletelist +=record.data.editid + ',';

} if (record.data.download == '0'&& record.data.downloadid.downloadid != ""){

deletelist +=record.data.downloadid + ',';

}

 

//添加

if (record.data.authid == "" && record.data.auth == '1') {

addauthlist +=record.data.guid + ',';

}if (record.data.editid == ""&& record.data.edit == '1') {

addeditlist +=record.data.guid + ',';

}if (record.data.downloadid == ""&& record.data.download == '1') {

adddownloadlist +=record.data.guid + ',';

}           

}

 

 

添加合计行

gridstore.load({params: { start: 0, limit: pageSize }, callback: function() { amountsum(); } });

@*-----------合计-----------*@

<script>

    function amountsum(){

        //var rowCount =Ext.getCmp("financepaymentgrid").store.getCount();

        varrowCount = gridstore.getCount();

        var p = newExt.data.Record({ fields: ['id', 'cmp_id', 'cmlongname', 'paymnet_date', 'crop_id', 'paymnet_name', 'paymnet_item', 'amount', 'verification', 'difference', 'statename', 'paymnet_state', 'paymnet_gen_time', 'paymnet_acc_time', 'paymnet_last_verifi_time', 'paymnet_final_verifi_time', 'pay_appointed_day', 'gen_id'] });//定义一行要插入的record

        var amount= 0, verification = 0, difference = 0;

        gridstore.each(function (record) {

            if(record.data.amount != null) {

                amount +=Number(record.data.amount);//叠加需要合计的列值返回给sum

            }

            if(record.data.verification != null) {

                verification +=Number(record.data.verification);//叠加需要合计的列值返回给sum

            }

            if(record.data.difference != null) {

                difference +=Number(record.data.difference);//叠加需要合计的列值返回给sum

            }

        });

        //Ext.getCmp('financepaymentgrid').store.each(function(record) {

        //    if(record.data.amount != null) {

        //       amount += Number(record.data.amount);//叠加需要合计的列值返回给sum

        //    }

        //});

       

        p.set('id', '');

        p.set('cmp_id', '');

        p.set('cmlongname', '<fontstyle=\'color:red;line-height:25px;font:bold;font-size:large;\'>合计</font>');

        p.set('paymnet_date', '');

        p.set('crop_id', '');

        p.set('paymnet_name', '');

        p.set('paymnet_item', '');

        p.set('amount', '<font style=\'color:red;line-height:25px;\'>' + amount + '</font>');//合计值放到num列中

        p.set('verification', '<fontstyle=\'color:red;line-height:25px;\'>' + verification + '</font>');

        p.set('difference','<fontstyle=\'color:red;line-height:25px;\'>' + difference + '</font>');

        p.set('statename','');

        p.set('paymnet_state', '');

        p.set('paymnet_gen_time', '');

        p.set('paymnet_acc_time', '');

        p.set('paymnet_last_verifi_time', '');

        p.set('paymnet_final_verifi_time', '');

        p.set('pay_appointed_day', '');

        p.set('gen_id', '');

        //Ext.getCmp('financepaymentgrid').store.insert(0,p);//将赋值后的新行插入到grid的第一行中

        gridstore.add(p);

    }   

</script>

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值