2013-11-14 52 views
0

我只想在'保存'按钮点击extjs代码获得活动选项卡。 我的代码下面给出:得到活动标签上的按钮点击extjs

Ext.require([ 
    'Ext.tab.*', 
    'Ext.window.*', 
    'Ext.tip.*', 
    'Ext.layout.container.Border' 
]); 

Ext.define('WebCare.UI.RoleManagerAdminWindow', { 
    extend: 'Ext.window.Window', 
    id: 'rolemanageradminwindow', 
    modal: true, 
    title: 'Manage Role & Permission', 
    closable: true, 
    closeAction: 'hide', 
    width: 600, 
    height: 550, 
    minWidth: 700, 
    minHeight: 200, 
    layout: 'border', 
    bodyStyle: 'padding: 5px;', 

    listeners: { 
     show: function (sender, eOpts) { 
      var self = sender; 
      vent.trigger("WindowLoad"); 
     } 
    }, 
    items: [ 
     { 
      id: 'rolemanageradmintab', 
      region: 'center', 
      xtype: 'tabpanel', 

      constructor: function (config) { 
       var self = this; 
       self.callParent(config); 
      }, 
      items: [ 
       { 
        xtype: 'rolemanagereditor', 
        id:'1' 
       }, 
       { 
        xtype: 'agencyeditor', 
        id: '2' 
       } 
      ], 
      listeners: { 
       'tabchange': function (tabPanel, tab) {     
       } 
      } 
     } 
    ], 
    dockedItems: [ 
     { 
      xtype: 'toolbar', 
      dock: 'bottom', 
      ui: 'footer', 
      defaults: { minWidth: 70 }, 
      style: { 
       background: "#d6e3f3"//, "#d9ebff", 
      }, 
      height: 40, 
      items: [ 
       { xtype: 'component', flex: 1 }, 
       Ext.create('Ext.button.Button', { 
        height: 25, 
        text: 'Close', 
        disabled: false, 
        handler: function() { 
         this.up('.window').close(); 
        } 
       }), 
       Ext.create('Ext.button.Button', { 
        height: 25, 
        text: 'Save', 
        disabled: false, 
        handler: function() { 
        } 
       }) 
      ] 
     } 
    ] 
}); 
+1

请说明您遇到的问题/错误,并尽量减少核心方面的帖子中的代码 – LionC

回答

2

一个简单的例子来获得活动标签的一个tabpanel当您单击保存按钮。

Ext.onReady(function() { 
    var tabPanel = Ext.create('Ext.tab.Panel', { 
     width: 300, 
     height: 200, 
     activeTab: 0, 
     items: [ 
      { 
       title: 'Tab 1', 
       bodyPadding: 10, 
       html: 'A simple tab' 
      }, 
      { 
       title: 'Tab 2', 
       html: 'Another one' 
      }, 
      { 
       title: 'Tab 3', 
       html: 'Another one' 
      } 
     ], 
     buttons: [ 
      { 
       text: 'Save', 
       handler: function() { 
        var activeTab = tabPanel.getActiveTab(); 
        alert("The active tab in the panel is " + activeTab.title); 
       } 
      } 
     ], 
     renderTo: Ext.getBody() 
    }); 
});