Window .center() working only first time

2 posts, 0 answers
  1. Tomaz
    Tomaz avatar
    10 posts
    Member since:
    May 2012

    Posted 27 Aug 2012 Link to this post

    I have code on window :

    .Events(events => events.Open("WindowToCenter"))

    and javascript:

    function WindowToCenter() {
     
            var window = $('#windowEditArticle').data("kendoWindow");
            window.center();
        }

    Problem is that .center() working only first time. When I open window next time window position is total wrong.

    Any idea?
  2. Dave
    Dave avatar
    35 posts
    Member since:
    Oct 2012

    Posted 13 Nov 2012 Link to this post

    I figured this one out.

    I was using the same exact code as you, and had the same problem. Change your function to this:

    function centerWindow(e) {
        e.sender.center();
    }
    (e is automatically passed by the Kendo window's Open event.)

    For some reason, this fixes the problem for me. Hope this helps!
Back to Top