Extjs 双击关闭tab页

var tab = new Ext.TabPanel({
   region:'center',
   deferredRender:false,
   activeTab:0,
   resizeTabs:true, // turn on tab resizing
   minTabWidth: 115,
   tabWidth:135,
   enableTabScroll:true,
   //双击关闭tab页
   initEvents: function() {
      Ext.TabPanel.superclass.initEvents.call(this);
      this.mon(this.strip, 'mousedown', this.onStripMouseDown, this);
      //ADD:monitor title dbclick
      this.mon(this.strip, 'dblclick', this.onTitleDbClick, this);
   },
   //ADD: handler  双击关闭tab页
   onTitleDbClick: function(e, target, o) {
      var t = this.findTargets(e);
      if (t.item.fireEvent('beforeclose', t.item) !== false) {
          t.item.fireEvent('close', t.item);
          this.remove(t.item);
      }
   }
  });

你可能感兴趣的:(Extjs 双击关闭tab页)