Results 1 to 4 of 4

Thread: [RESOLVED] x and y position (outside of jQuery UI Dialog)

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Resolved [RESOLVED] x and y position (outside of jQuery UI Dialog)

    Ok - I'm using the jQuery UI Dialog box - which places a "overlay" object over the entire screen - with the dialog box in front of it.

    I've attached a click EVENT to the overlay object - and I just clicked the HEADING of a grid that appears through the overlay.

    How can I even begin to use that X and Y to find that COLUMN HEADING??
    Attached Images Attached Images  
    Last edited by szlamany; Nov 24th, 2013 at 07:14 AM.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,594

    Re: x and y position

    If this make no sense you can stop me as i am just guessing right now because i haven't used the Jquery dialog.
    So using .offset or .closest().offset you will get the position of the dialog box (or div contains it (?)). After that you can do a subtraction of the page window.height , width or document.height, width to get the relevant position of the dialog within the page and go from there. Just a thought here, not sure it's doable.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: x and y position

    Thanks - .offset was where I needed to go! I looked at .position as I was quitting last night and it didn't seem right...

    At any rate - this code works. Note that I had to use .innerWidth and .innerHeight to account for the padding (but not the borders). Nice thing about the OVERLAY div is that it covers the entire DOCUMENT - so it's at 0,0 making the clientX and clientY really work nicely!

    Code:
            function graphGrid(strId, objGraph, blnDoReader) {
                blnInGraph = true;
                var wesPC = $("#" + strId);
    .
    .
    .
                var wesCols = wesPC.find(".slick-header-column");
                var wesCol = [];
                for (var i = 0; i < wesCols.length; i++) {
                    wesCol = $(wesCols[i]);
                    g_graphCols.push({ offset: wesCol.offset()
                                    , height: wesCol.innerHeight()
                                    , width: wesCol.innerWidth()
                                    , name: wesCol.find(".slick-column-name").html()
                    });
                }
    .
    .
    .
            function overlayClick(sender) {
                if (blnInGraph) {
                    $('.acs-dlg-graph-item').val('');
                    for (var i = 0; i < g_graphCols.length; i++) {
                        if (sender.clientX >= g_graphCols[i].offset.left && sender.clientX <= g_graphCols[i].offset.left + g_graphCols[i].width
                            && sender.clientY >= g_graphCols[i].offset.top && sender.clientY <= g_graphCols[i].offset.top + g_graphCols[i].height) {
                            $('.acs-dlg-graph-item').val(g_graphCols[i].name);
                        }
                    }
                }
            }
    And it looks like this!!
    Attached Images Attached Images  
    Last edited by szlamany; Nov 24th, 2013 at 07:21 AM.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: [RESOLVED] x and y position (outside of jQuery UI Dialog)

    Moved from XML, HTML, Javascript, Web and CSS as per OP's request
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width