2017-09-05 62 views
0

我有tabpanel,默认情况下所有选项卡都处于禁用状态。根据条件,一些标签将被启用,我已经完成了该部分。现在我想为选项卡添加单击事件,我尝试使用tabchange,但问题是当我在运行时启用选项卡时tabchange事件被触发,但我希望在用户单击选项卡时触发它。如何在Tabpanel中为ExtJS选项卡添加单击事件

var empTabPanel= new Ext.tab.Panel({ 
     id: 'emptabpanel', 
     width: '100%', 
     xtype: 'container', 
     layout: 'hbox', 
     items: [{ 
       title: 'Personal Details', 
       border: 0, 
       id: 'PERSONAL_DETAILS' 
      },{ 
       title: 'Department Details', 
       border: 0, 
       id: 'DEP_DETAILS' 
      },{ 
       title: 'Leave Details', 
       border: 0, 
       id: 'LEAVE_DETAILS' 
      }] 
    }); 
+2

尝试在运行时使用suspendEvent功能。当你的操作完成时使用resumeEvent函数。 –

+0

谢谢D.V它工作:) –

回答

2

我已经写评论,但大多数人没有看到评论,这就是为什么我写这篇文章在岗。

尝试在运行时使用suspendEvent函数。当您的操作完成后使用resumeEvent功能。

如何使用上述功能?

tabPanel.suspendEvent (eventName) 
tabPanel.resumeEvent (eventName) 

- >不要忘了resumeEvent

谢谢.. :)

0

你可以添加一个默认的监听

var empTabPanel= new Ext.tab.Panel({ 
 
      ... 
 
    \t  defaults: { 
 
       handler: function(item){ 
 
       ... 
 
       if(item is tab1){ 
 
        // active/inactive 
 
       } 
 
       else if(){}... 
 
       } 
 
      }, 
 
      items: [{ 
 
        title: 'Personal Details', 
 
        border: 0, 
 
        id: 'PERSONAL_DETAILS' 
 
       },{ 
 
        title: 'Department Details', 
 
        border: 0, 
 
        id: 'DEP_DETAILS' 
 
       },{ 
 
        title: 'Leave Details', 
 
        border: 0, 
 
        id: 'LEAVE_DETAILS' 
 
       }] 
 
       
 
      });

相关问题