Grid[ cellclick、beforeedit、afteredit ]

cellclick: function(grid, rowIndex, columnIndex, e) {   

         var record = grid.getStore().getAt(rowIndex); // 获得当前行的记录

          varrecord = grid.getStore().getAt(rowIndex)).get(columnName);//获得列表某行某列的值

         grid.store.getAt(rowIndex).set(columnName,value);//改变某行某列的值

         var fieldName = grid.getColumnModel().getDataIndex(columnIndex); //获得列名(字段名)   

         var data = record.get(fieldName);//再从记录中获得这列的value   

         alert('你当前单击的单元格的value:' + data);   

      }  

 

 

//添加明细或查看详情弹出详情编辑框

        grid.on('cellclick',function (thisgrid, rowIndex, columnIndex, e) { //获得Ext.grid.EditorGridPanel编辑信息

            if (columnIndex == 9) {//公司账单

                var id =thisgrid.getStore().getAt(rowIndex).data.id;

                Ext.MessageBox.show({

                    title: '提示',

                    msg: '确定要分配吗?',

                    buttons: {ok: "分配", cancel: "取消" },

                    //buttons:Ext.MessageBox.OKCANCEL,

                    fn: showResult,

                    animEl: 'mb4',

                    icon:Ext.MessageBox.QUESTION

                });

 

            }

        });

 

        function showResult(btn) {

            if (btn == "ok") {

               Ext.MessageBox.alert("提醒", "分配成功");

                gridstore.reload();

            }

        };

 

 

 

 

 

viewConfig : {

                forceFit : true

            },

           listeners : {

               //单元格单击事件

                'cellclick':function (grid, rowIndex, columnIndex, e){

                   if(columnIndex == 7){//合作信息

                        var row = grid.getStore().getAt(rowIndex).data;

                        var productType = row.ProductType;

                        var productID = row.ProductID;

                        var cur_row = JSLINQ(checkedData).First(function(item) { return item.ProductID == productID });

                        var spinfo = cur_row.CoopInfoId;

                        var CMID = parent.CMID;

                        var areaCode = Ext.getCmp('HZArea').getValue();

                       cur_productID = productID;

                       cur_rowIndex = rowIndex;

 

                        var url = '';

                        if(productType == '社保'){

                            url = "@Url.Action("Social", "CorpInfo")"+"?Spinfo=" + spinfo + "&CMID="+CMID+"&areaCode="+areaCode;

                        }else if(productType == '公积金'){

                            url = "@Url.Action("Fund", "CorpInfo")"+"?Spinfo=" + spinfo+ "&CMID="+CMID+"&areaCode="+areaCode;

                        }else if(productType == '商保'){

                            url = "@Url.Action("ShangBao", "CorpInfo")"+"?Spinfo=" + spinfo+ "&CMID="+CMID+"&areaCode="+areaCode;

                        }else if(productType == '周期性'){

                            url = "@Url.Action("Circle", "CorpInfo")"+"?Spinfo=" + spinfo;

                        }else if(productType == '一次性'){

                            url = "@Url.Action("Once", "CorpInfo")"+"?Spinfo=" + spinfo;

                       }

                        //弹出框

                        winCoorpinfo = new Ext.Window({

                            title        : '合作信息',

                            layout      : 'fit',

                            width       : 800,

                            height      : 380,

                            closeAction :'close',

                            plain       : true,

                            modal        : true,

                            items:[ new Ext.Panel({        

                                resizeTabs :true,

                                autoScroll : false,

                                html:'<iframe scrolling="auto"frameborder="0" width="100%" height="100%" src='+ url +'></iframe>'

                            })]

                       });

                       winCoorpinfo.show();

                   }

               },

               //编辑前,获取编辑当前行

                'beforeedit':function (e){

                   SocialCalc = e.record.data.SocialCalc;

                   FundCalc = e.record.data.FundCalc;

                   cur_productTypeName = e.record.data.ProductType;

                   cur_productID = e.record.data.ProductID;

               },

               //编辑后,更新数据到全局数据集

                'afteredit':function (e){

                    var row = e.record.data;

                   if(e.field == 'CoopInfoId'){ //合作信息另作处理

                    }else{

                        //找出当前编辑的行

                        var cur_row = JSLINQ(checkedData)

                            .First(function(item){return item.ProductID == cur_productID;});

                       cur_row.RealCost = e.record.data.RealCost ;

                       cur_row.ExecuteCost = e.record.data.ExecuteCost ;

                       cur_row.ServiceCost = e.record.data.ServiceCost ;

                       cur_row.CalcuteTypeName = e.record.data.CalcuteTypeName ;

                       cur_row.IsBigBag = e.record.data.IsBigBag ;

                   }

               }

            },

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值