PDA

View Full Version : Showing popup menu on onmouseover



Pravin.Pawar
29 Aug 2012, 4:01 AM
Hi,

I have to populate ExtJS menu on onmouseover of div control. Please let me know how can if you have any idea.

Regards, Pravin

redraid
29 Aug 2012, 4:53 AM
Add listener to div mouseenter event.
html:

?<div id="test">Test</div>???????????????????????????
js:

Ext.onReady(function() {
var menu = Ext.create('Ext.menu.Menu', {
floating: true,
items: [{
text: 'regular item 1'},
{
text: 'regular item 2'},
{
text: 'regular item 3'}]
});

var div = Ext.get('test');
div.on('mouseenter', function(e) {
menu.showAt(e.getXY());
});
console.log(div);
});?

live: http://jsfiddle.net/6mS9G/1/

Pravin.Pawar
29 Aug 2012, 7:39 PM
Thanks... nice solution.

Pravin