CheckboxSelectionModel 속성 값을 설정하여 GridPanel 확인란을 사용할 수 있는지 여부를 확인합니다.

6451 단어
코드 구현
            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);   

                             }   

                        }   

                  }                                        

             });

좋은 웹페이지 즐겨찾기