简体   繁体   English

列渲染,监听点击事件

[英]Column render, listen to click event of a <i> tag?

I have a render function on a grid column that basically returns some html, the html consists of a tag to display an icon and then some text. 我在网格列上有一个渲染函数,该函数基本上返回一些html,该html由一个标记组成,以显示图标,然后显示一些文本。 Sort of like this 有点像这样

 <i class="some class"> </i> some text

I only want to attach a click event to the i tag, not the text, so itemClick wouldn't work. 我只想将click事件附加到i标签,而不是文本,所以itemClick将不起作用。 How do I attach ane element listener just to the i tag that is returned from my render function ? 如何将ane元素侦听器仅附加到我的渲染函数返回的i标签上?

A little lost ? 有点迷路了? Any ideas? 有任何想法吗?

I did look at use a columnaction but i can only use an img, and no text can be set after the image. 我确实看过使用columnaction,但是我只能使用img,并且在图像后不能设置任何文本。

Any ideas ? 有任何想法吗 ?

Thanks 谢谢

Listen for the cellclick event, then check the event target: 监听cellclick事件,然后检查事件目标:

listeners: {
    cellclick: function(grid, td, cellIndex, record, tr, rowIndex, e) {
        if (cellIndex === whatever && Ext.fly(e.target).hasCls('foo')) {
             // Go
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM