For the below code snippet, I want to add a mouse hover event such that on mouse over, background color of fieldset item changes and an image is display next to the fieldset item
对于下面的代码片段,我想添加鼠标悬停事件,以便在鼠标悬停时,字段集项目的背景颜色发生变化,图像显示在字段集项目旁边
var mainGroup = {
xtype: 'fieldset',
margin: '0 40 0 40',
border: true,
title: '<html><h3>' + displayLabel + '</h3></html>',
defaults: {
anchor: '100%',
padding: 3,
width: '80%',
},
layout:'hbox',
items: []
};
Please help me in this regard.
请帮助我这方面。
1 个解决方案
#1
0
Add this to your fieldset configs:
将其添加到您的fieldset配置:
listeners: {
render: function () {
this.getEl().on('mouseover', function () {
alert('Mouse over!');
//logic of whatever you want happening...
});
}
}
I would also look into mouseenter
, if you don't want the logic to be executed every time the user moves the mouse just even slightly within the fieldset.
如果你不希望每次用户在字段集中稍微移动鼠标时执行逻辑,我也会调查mouseenter。
#1
0
Add this to your fieldset configs:
将其添加到您的fieldset配置:
listeners: {
render: function () {
this.getEl().on('mouseover', function () {
alert('Mouse over!');
//logic of whatever you want happening...
});
}
}
I would also look into mouseenter
, if you don't want the logic to be executed every time the user moves the mouse just even slightly within the fieldset.
如果你不希望每次用户在字段集中稍微移动鼠标时执行逻辑,我也会调查mouseenter。