PDA

View Full Version : Ext.Menu doesn't keep attached to the div which open it



fgravin
22 Oct 2012, 8:48 AM
Hi,

I have some issues with Ext.menu.

I have a Menu, without any Ext button or other menu to open it.
If i click on a div, i use showAt() with the position of my div then it displays the menu.

The problem is that if i scroll in the page (not in the menu), the page will scroll behind but the menu will stay at its position. It won't follow the div it "belongs to".

Is there any way that i can keep my menu attached to the div under which it is shown ??

the code:


...
this.curMenu = new Ext.menu.Menu({
floating: true,
resultsView: dv,
showSeparator: false,
cls: 'no-icon-menu',
items: its,
});
var menuElt = Ext.get(Ext.DomQuery.selectNode('div.'+type+'Menu', node));
menuElt.on('click', function(){
this.curMenu.showAt([menuElt.getX(), menuElt.getY() + menuElt.getHeight()]);
}, this);

Thanks

mitchellsimoens
25 Oct 2012, 6:43 AM
The reason is you are showing it at a certain XY not within the div. Not sure what would happen but you can try to renderTo to the div.

fgravin
30 Oct 2012, 7:19 AM
A solution could be to replace the menu manually.
But i can't find how to get the heigth that have been scrolled on a scroll event


this.ownerCt.ownerCt.body.on('scroll', function(e,t,o){
alert(e.getWheelDelta());
});


always display 0