2011-03-01 105 views

回答

0
beforeadditem:function(self, recordValue) { 
     var start = 0; 
     var end = 0; 
     var record = this.findRecord(this.valueField, recordValue); 
     var recordIndex = this.store.indexOf(record); 
     if(window.event.shiftKey) { 
      this.multiSelectMode = true; 
      if(this.firstChoiceIndex == undefined) { 
       this.firstChoiceIndex = recordIndex; 
       this.view.all.item(recordIndex).addClass('x-combo-selected-shift'); 
       return false; 
      } else { 
       this.secondChoiceIndex = recordIndex; 
       if(this.firstChoiceIndex > this.secondChoiceIndex) { 
        start = this.secondChoiceIndex; 
        end = this.firstChoiceIndex; 
       } else if(this.secondChoiceIndex > this.firstChoiceIndex) { 
        start = this.firstChoiceIndex; 
        end = this.secondChoiceIndex; 
       } 
       var selectedRecords = this.store.getRange(start, end); 
       Ext.each(selectedRecords, function(item, index, allitems) { 
        self.addRecord(item) 
       }); 
       this.firstChoiceIndex = undefined; 
       this.secondChoiceIndex = undefined; 
       return false; 
      } 
     } else { 
      this.firstChoiceIndex = undefined; 
      this.secondChoiceIndex = undefined; 
      return true; 
     } 
    } 

添加该监听器,它的工作原理。 x-combo-selected-shift类与x-combo-selected类相同。它只是被命名为不同,所以突出显示将保留在您移出鼠标后点击的项目上。

相关问题