EXTJS中如何获得TabPanel的各个tab的点击事件

时间:2022-03-14 18:28:47

直接给Panel 添加监听(show)事件,即可实现。【不仅仅首次点击有效哦】

 listeners: {
                   'show': function (t, eOpts) {
                       alert(1);
                   }
               }



EXTJS中如何获得TabPanel的各个tab的点击事件
完整代码

var attinfocondition = Ext.create('Ext.panel.Panel',
           {
               xtype: 'panel',
               title: '使用条件',
               closeAction: 'hide',
               id: 'dmsVIPCouponBase2Grid',
               height: 400,
               //store: 'md.mdECardGrpOpenStore',
               layout: 'border',
               //border: true,
               items: [
                   {
                       region: 'north',
                       xtype: 'panel',
                       height: 120,
                       items: [attInfomdrole]
                   },
                    {
                        region: 'center',
                        xtype: 'panel',
                        height: 100,
                        layout: 'fit',
                        margin: '0 0 0 0',
                        items: [attInfomdECardGrp]
                    }, {
                        region: 'south',
                        xtype: 'panel',
                        height: 50,
                        // split: true,
                        margin: '0 0 0 0',
                        items: [
                        {
                            xtype: 'label',
                            flex: 1,
                            layout: 'anchor',
                            text: '优惠券使用条件:',
                            anchor: '96%',
                        }, {
                            xtype: 'label',
                            flex: 1,
                            name: 'NoteCondition',
                            id: 'dmsVIPCouponBase2GridNoteCondition',
                            layout: 'anchor',
                            text: '',
                            anchor: '96%',
                        },
                        ]
                    }
               ],
               listeners: {
                   'show': function (t, eOpts) {
                       alert(1);
                   }
               }
           });