extjs context menu is showing up occaisionally in the wrong place. Top left of screen, sometimes all the way left-middle. A lot of times it shows up fine, but it’s showing up in the wrong place enough that it’s annoying.
here is the start to my menu code:
grid<?php echo $count; ?>.contextMenu = new Ext.menu.Menu({
id: 'gridCtxMenu<?php echo $count; ?>',
items: [ ...
Here is where i’m attaching the showAt to the menu button “#actions_button;
var action_button = 'actions_button' + <?php echo $count; ?>;
Ext.fly(action_button).on('click', function() {
var xy = this.getXY();
xy[1] += this.getHeight();
grid<?php echo $count; ?>.contextMenu.showAt(xy);
});
Using extjs 3.2, any help is appreciated!
It may be necessary to see the whole code in order to properly analyze the problem.
One possible cause is that
Ext.flywrites to a singleton. That is, at the time the ‘click’ handler is run, the flyweight object points to a different DOM node, notaction_button. This means in turn thatthis.getXY()returns crap.Use
Ext.get(action_button)orExt.fly(action_button, 'MYNAMESPACE')instead.