关闭

Grid[ cellclick、beforeedit、afteredit ]

2310人阅读 评论(0) 收藏 举报
分类:

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
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:123600次
    • 积分:1650
    • 等级:
    • 排名:千里之外
    • 原创:52篇
    • 转载:9篇
    • 译文:0篇
    • 评论:4条
    最新评论