This is a migrated thread and some comments may be shown as answers.

Popup Positioning

3 Answers 195 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 2
Steve asked on 21 Oct 2008, 02:54 AM
I'm using the EditMode="PopUp" and I have script that will center the popup window over the visible portion of the screen.  Except there's a hitch: I'm not explicitly setting the height of my popup but my script relies on knowing the height of the popup object.  How can I get the height if I don't explicitly set it?

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 21 Oct 2008, 09:06 AM
Hi Steve,

I assume that you set the position of the pop-up edit form OnPopUpShowing client-side event handler. But unfortunately if you have not set explicitly the form height, you cannot retrieve the real form height here. Therefore I suggest that you set such or use some approximate value for your calculations.

I hope this helps.

Kind regards,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Andy
Top achievements
Rank 1
answered on 14 Nov 2011, 05:24 PM

If you have a long scrolling grid, I adjusted the script to the following.  This positions the popup on the window, otherwise, it is always centerd in the grid, which could be up or down depending on the lenght of the grid. 

var popUp;
 
function PopUpShowing(sender, eventArgs) {
    //getMouseXY(sender.get_element());
    popUp = eventArgs.get_popUp();
    var gridWidth = sender.get_element().offsetWidth;
    var gridHeight = sender.get_element().offsetHeight;
    //var clickpos =
    var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
    var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
    popUp.style.left = ((gridWidth - popUpWidth) / 2 + sender.get_element().offsetLeft).toString() + "px";
    // popUp.style.top = ((gridHeight - popUpHeight) / 2 + sender.get_element().offsetTop).toString() + "px";
     
    var e = window.event;
    var posy = e.clientY + document.body.scrollTop
        + document.documentElement.scrollTop;
   // alert(posy);
    //alert((sender.get_element().offsetTop)).toString();
    popUp.style.top = (posy + sender.get_element().offsetTop).toString() + "px";
   // alert(popUp.style.top);
}
0
Hassan
Top achievements
Rank 1
answered on 19 Feb 2015, 02:21 PM
Hi,
I have a grid with edit mode "popup" and the popup is opening at the bottom of the page for both Add New and Edit.

I checked the same issue at the following link:
http://www.telerik.com/forums/kendo-ui-grid-popup-template-

But its not working for me. Can anyone help to resolve the issue.

I am using latest version of Kendo UI.
Thanks in Advance.
Tags
Grid
Asked by
Steve
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
Andy
Top achievements
Rank 1
Hassan
Top achievements
Rank 1
Share this question
or