单击EXTJS中的选项卡面板的监听器 [英] click listener for tab panel in EXTJS

查看:126
本文介绍了单击EXTJS中的选项卡面板的监听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在extjs中使用一个标签面板。我想在标签上点击时显示一个提醒。但我不知道如何。



这是我现在所做的:

  xtype:'tabpanel',
activeTab:0,
region:'center',
items:[
{
xtype: 'panel',
title:'All',
items:[grid]

},
{
xtype:'panel',
标题:'已关闭'
},
{
xtype:'panel',
标题:'打开'
}
],
listeners:{
click:function(){
alert('test');
}
}
}

解决方案

中没有任何标签点击的事件。 TabPanel ,但是您可以绑定到每个选项卡上的点击事件:

  Ext.createWidget('tabpanel ',{
items:[...],
listeners:{
render:function(){
this.items.each(function(i){
i.tab.on('click',function(){
alert(i.title);
});
});
}
}
});

注意:这是基于ExtJS 4的代码。


i use a tab panel in extjs. I want to display an alert when clicked on a tab. But i am not sure how.

This is what i do now:

{
                xtype: 'tabpanel',
                activeTab: 0,
                region: 'center',
                items: [
                    {
                        xtype: 'panel',
                        title: 'All',
                        items: [grid]

                    },
                    {
                        xtype: 'panel',
                        title: 'Closed'
                    },
                    {
                        xtype: 'panel',
                        title: 'Open'
                    }
                ],
                 listeners: {
            click: function () {
                alert('test');
            }
                         }
            }

How can is display All, Closed or Open when there is clicked on that tab?

解决方案

There is no event for tab click in TabPanel, however you can bind into click event on each tab:

Ext.createWidget('tabpanel', {
    items: [...],
    listeners: {
        render: function() {
            this.items.each(function(i){
                i.tab.on('click', function(){
                    alert(i.title);
                });
            });
        }
    }
});

Notice: this is ExtJS 4 based code.

这篇关于单击EXTJS中的选项卡面板的监听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆