Extjs CheckboxSelectionModel 置为无效 选择触发事件

var smQd = new Ext.grid.CheckboxSelectionModel({
        renderer:function(value, metaData, record, rowIndex, colIndex, store){
                        if((record.data['xgdjzt'].split("-")[0] == 2)||(record.data['khlxzt'].split("-")[0] == 2)){
                             return "";
                        }else{
                            return '<div class="x-grid3-row-checker"> </div>';
                        }
                   },
           //不允许使用点击表格形式修改选择
           handleMouseDown:Ext.emptyFn,
        listeners:{
                      /*'rowselect':function(sm,rowIndex,record){
                        console.log('rowselect',rowIndex)
                      },
                      'rowdeselect':function(sm,rowIndex,record){
                        console.log('rowdeselect',rowIndex)
                      },*/
                      'selectionchange':function(sm){
                          if(sm.getSelections().length>0){
                              var select_zyed = 0;
                              for(var i=0;i<sm.getSelections().length;i++){
                                  if((sm.getSelections()[i].data['xgdjzt'].split("-")[0] != 2)&&(sm.getSelections()[i].data['khlxzt'].split("-")[0] != 2)){
                                      var jyje_arr = sm.getSelections()[i].data['jyje'].split(",");
                                    var jyje_sel = "";
                                    for(var j = 0; j< jyje_arr.length; j++){
                                        jyje_sel += jyje_arr[j];
                                    }
                                      select_zyed = select_zyed + parseFloat(jyje_sel) ;
                                  }
                              }
                              used_ed.setValue(rendererZhMoney(select_zyed));
                              //var total_ed_arr = total_ed.getValue().split(",");
                              var total_ed_arr = Ext.getCmp("total_ed").getValue().split(",");
                            var total_ed = "";
                            for(var j = 0; j< total_ed_arr.length; j++){
                                total_ed += total_ed_arr[j];
                            }
                            total_ed = parseFloat(total_ed);
                            leave_ed.setValue(rendererZhMoney(total_ed-select_zyed));
                          }else{
                            used_ed.setValue(rendererZhMoney(0));
                            //leave_ed.setValue(total_ed.getValue());
                            leave_ed.setValue(Ext.getCmp("total_ed").getValue());
                          }
                        
                      },
                       'beforerowselect':function(sm,rowIndex,keepExisting,record){
                            if((record.data['xgdjzt'].split("-")[0] == 2)||(record.data['khlxzt'].split("-")[0] == 2)){
                                return false;
                            }else{
                                return true;
                            }        
                      }
                 }
    });

 

posted @ 2013-10-11 22:08 残星 阅读(...) 评论(...) 编辑 收藏