如何在Ext.js中附加图标的On Click事件 [英] How to attach an On Click event for Icon In Ext.js

查看:197
本文介绍了如何在Ext.js中附加图标的On Click事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有标头的Ext.js容器,标头包含一个文本作为标题和一个图标.用于刷新选项卡.我如何获得该容器标题的图标单击事件? 香港专业教育学院使用icon: '@Url.Content("~/Images/icon-supp.png")',来获取文本旁边的图标. 这是我的代码:

I Have an Ext.js Container with an header , header contains a text as its title and an icon . Used to refresh the tab . How can i get icon click event for that container header ? Ive used icon: '@Url.Content("~/Images/icon-supp.png")', for getting the icon next to the text. Here is my code:

"TabChange"也仅在更改选项卡时激活,而在单击图标时不激活.

'TabChange' also activates only when tab is changed and not while clicked on icon.

更多信息:我有一个中心容器.我在其中添加了

More information : I have an center container . Im adding an Ext.tab.Panel to it , which has

 items: [ 
            {
                                xtype: 'container',
                                title: 'FooText',
                                id: 'FooPanel',
                                icon: '@Url.Content("~/Images/icon-refresh.png")',
  tools: [{
                        type: 'help',
                        handler: function(){
                            //Doesnt hit on click of tab
                        }
                    }, {
                        itemId: 'refresh',
                        type: 'refresh',
                        hidden: true,
                        handler: function(){
                            //Doesnt hit on click of tab
                        }
                    }
                    }],
                                listeners: {
                                    activate: function () {
                                       //This just hits only once when that tab gets activated./
                                        alert('you clicked me');
                                    },
                                    click:function(){//Doesnt work},
                                        },
                                    handler:function(){//Doesnt work},

                                autoScroll: true,

                            },

现在我所需要的只是单击图像图标上的handel事件.有可能吗?

Now all i need is a handel event on click of image icon. Is it possible ?

推荐答案

最后,我继续在标题上使用html图像按钮并处理onClick事件.

Finally I went on using an html image button on the title and handling the onClick event.As such

title: 'fooTitle <input type="image" style="float: right;padding-left:10px; height: 15px;width:30px; " src="Images/icon-refresh.png" onclick="refreshFooTab()"></input>',

function refreshFooTab()
{...}

这篇关于如何在Ext.js中附加图标的On Click事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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