PDA

View Full Version : Ext.CycleButton event for mouseout over menu



karthik_br
23 May 2011, 12:01 PM
Hello,

I have a cycle button with a menu. I want to hide the menu when user does mouse out over menu (not button).

I see only two events menutriggerout and mouseout. Both seem to fire for mouseout over the triggering button but I want to hide when mouse out of the menu not the triggering button.

Please help.

Regards,
Karthik

skirtle
23 May 2011, 7:53 PM
You should be able to use the code below as a starting point but I suspect your users will find hiding the menu like this annoying.


var cycleButton = new Ext.CycleButton({
renderTo: Ext.getBody(),
showText: true,
items: [
{text: 'Item 1', checked: true},
{text: 'Item 2'}
]
});

cycleButton.menu.on('mouseout', function(menu, ev) {
if (!menu.getEl().contains(ev.getRelatedTarget())) {
menu.hide();
}
});