zoukankan      html  css  js  c++  java
  • ExtJs 使用点滴 十四 通过设置CheckboxSelectionModel属性值来实现GridPanel复选框可用不可用

    var sm = new Ext.grid.CheckboxSelectionModel({singleSelect : false,renderer:function(v, p, record)
                            {
                           
                           
                             
    if (record.get('ITEMNAME') == '总计:'){  
                                  
    return '';  
                              }  
                             
    return '<div class="x-grid3-row-checker">&#160;</div>';                        
                            },
                          onHdMouseDown :
    function(e, t) {  
                             
    if (t.className == 'x-grid3-hd-checker') {  
                                   e.stopEvent();  
                                  
    var hd = Ext.fly(t.parentNode);  
                                  
    var isChecked = hd.hasClass('x-grid3-hd-checker-on');  
                                  
    if (isChecked){  
                                      hd.removeClass(
    'x-grid3-hd-checker-on');  
                                     
    this.clearSelections();  
                                  }
    else {  
                                      hd.addClass(
    'x-grid3-hd-checker-on');  
                                     
    if (this.locked){  
                                         
    return;  
                                      }  
                                     
    this.selections.clear();  
                                     
    for (var i = 0, len = this.grid.store.getCount(); i < len; i++ ){  
                                         
    if (this.grid.store.getAt(i).data["ITEMNAME"] != '总计:'){  
                                              
    this.selectRow(i, true);  
                                          }  
                                     }  
                                  }  
                             }  
                          },                        
                      handleMouseDown :
    function(g, rowIndex, e){  
                           
    if (e.button !== 0 || this.isLocked()) {  
                                  
    return;  
                            }  
                           
    var view = this.grid.getView();  
                           
    if (e.shiftKey && !this.singleSelect && this.last != false ) {  
                                
    var last = this.last;  
                                
    this.selectRange(last, rowIndex, e.ctrlKey);  
                                
    this.last = last;  
                                 view.focusRow(rowIndex);  
                            }
    else{  
                                
    var isSelected = this.isSelected(rowIndex);  
                                
    if (e.ctrlKey && isSelected) {  
                                     
    this.deselectRow(rowIndex);  
                                 }
    else if(!isSelected || this.getCount() > 1){  
                                     
    if(this.grid.store.getAt(rowIndex).data["ITEMNAME"] != '总计:'){  
                                         
    this.selectRow(rowIndex, e.ctrlKey || e.shiftKey);  
                                      }  
                                      view.focusRow(rowIndex);  
                                 }  
                            }  
                      }                                       
                 });

  • 相关阅读:
    tomcat 调优-生产环境必备
    Spring中 BeanFactory和ApplicationContext的区别
    延迟队列DelayQueue简单入门
    RedisTemplate中opsForValue的使用 (复制粘贴的,没有练习,找时间回顾 )
    yum安装nginx的默认目录详解
    Centos 6无法使用yum解决办法
    JVM:jmap heap 堆参数分析MinHeapFreeRatio、MaxHeapFreeRatio、MaxHeapSize、NewSize、MaxNewSize
    maven下载Oracle jar包
    idea查看源代码出现/* compiled code */
    今日进度
  • 原文地址:https://www.cnblogs.com/FredTang/p/3478501.html
Copyright © 2011-2022 走看看