PDA

View Full Version : Trigger on mouse over/hover in Combobox



Ronits
17 Jan 2013, 5:49 AM
Hi,
I have set the hideTrigger property of combo box to true. Now, the trigger doesn't show up. How can I bring down the list on hover event, instead of the default click event.?

slemmon
17 Jan 2013, 6:11 AM
hideTrigger: true,
listeners: {
afterrender: function () {
var me = this;
me.el.on('mouseover', function () {
me.expand();
}, me);
}
}

Ronits
19 Jan 2013, 6:59 AM
Thanks. It worked.
I would like to have a mouse out event, when user does the mouse out event, on the combobox list i.e. moves the mouse out of the combobox value list, the combobox list should collapse. Any help

slemmon
19 Jan 2013, 9:35 AM
monitorMouseLeave should do the trick. the first param is how many milliseconds to wait before taking action.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.dom.Element-method-monitorMouseLeave




hideTrigger: true,
listeners: {
afterrender: function (combo) {
combo.el.on('mouseover', function () {
combo.expand();
}, combo);
}
, expand: function (combo) {
combo.mouseLeaveMonitor = combo.getPicker().el.monitorMouseLeave(500, combo.collapse, combo);
}
, destroy: function (combo) {
combo.getPicker().el.un(combo.mouseLeaveMonitor);
}
, single: true
}