[CLOSED] Are events' X and Y wrong inside windows?

  1. #1

    [CLOSED] Are events' X and Y wrong inside windows?

    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.
    Last edited by fabricio.murta; Apr 01, 2016 at 4:48 PM.
  2. #2
    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
    - More information required
    Fabrício Murta
    Developer & Support Expert
  3. #3
    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) {
            x-=w.body.getX();
            y-=w.body.getY();
        }
        return [x, y];
    }
    Strangely the documentation for ShowAt() and GetXY() is similar in ExtJs 4 and 6.
    Last edited by sveins12; Apr 01, 2016 at 5:29 PM.

Similar Threads

  1. Replies: 1
    Last Post: Nov 24, 2015, 3:36 PM
  2. Wrong time zone of calendar events
    By Dimitris in forum 1.x Help
    Replies: 9
    Last Post: Oct 23, 2013, 5:57 AM
  3. Windows inside of a Panel Dynamically
    By rodrigo.borges in forum 2.x Help
    Replies: 0
    Last Post: Aug 27, 2012, 6:50 PM
  4. I can't put Panel & Editor inside Windows ???
    By metallica87 in forum 1.x Help
    Replies: 0
    Last Post: Mar 20, 2010, 9:43 PM
  5. Replies: 1
    Last Post: Mar 17, 2009, 1:17 AM

Posting Permissions