Window .center() working only first time

4 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!
  3. Michael
    Michael avatar
    50 posts
    Member since:
    May 2014

    Posted 20 Feb 2018 Link to this post

    this is too not working , in the first time the window appears in the center, but after it always doesn't appear in the center.

    can you help me?

  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2109 posts

    Posted 23 Feb 2018 Link to this post

    Hello Michael,

    Could you post your Window declaration as well as how you open it after it is closed? This will give us an idea of its configuration and allow us to test its positioning on re-open. Also please specify the Kendo UI version you are using.

    Regards,
    Ivan Danchev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top