View Full Version : [CLOSED] Are events' X and Y wrong inside windows?

Mar 29, 2016, 1:23 AM
Ext.NET 4 RC: It seems that reading the e.getXY() inside a GridPanel's "beforeitemcontextmenu" gives the wrong values if the grid is inside a floating window. This makes context-menues appear at the wrong place. The exact same code worked fine in Ext.NET 2, which I am migrating from.

Actually it seems like it is adding the window's body's absolute position. I don't know if the error is in the xy-value or in the showAt-method of the contextmenu.

Mar 29, 2016, 2:21 AM
Hello @sveins12!

I am afraid the way to show menus might have changed in newer versions. From version 2 to 4 is a relatively big sum of changes, including how clicks are handled. So several overrides and methods might just have been surpassed by newer, reviewed ones.

I actually couldn't reproduce your issue by just binding a context menu to a grid panel. But I doubt you are just binding an <ext:Menu /> to the grid panel.

That said, we'll be unable to reproduce your issue and provide you proper advice unless you can provide us with a test case reproducing your problem there.

If in doubt on how to come up with a simple runnable example, please refer to these posts:
- Forum Guidelines For Posting New Topics (http://forums.ext.net/showthread.php?3440)
- More information required (http://forums.ext.net/showthread.php?10205)

Mar 31, 2016, 4:09 PM
Here is a function to get the correct XY:

function getActualXY(item, event) {
var x = event.pageX;
var y = event.pageY;
var w = item.up('window');
if (w) {
return [x, y];

Strangely the documentation for ShowAt() and GetXY() is similar in ExtJs 4 and 6.