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

Window .center() working only first time

3 Answers 402 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tomaz
Top achievements
Rank 1
Tomaz asked on 27 Aug 2012, 02:01 PM
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?

3 Answers, 1 is accepted

Sort by
0
Dave
Top achievements
Rank 1
answered on 13 Nov 2012, 03:50 PM
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!
0
Michael
Top achievements
Rank 1
answered on 20 Feb 2018, 10:07 AM

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?

0
Ivan Danchev
Telerik team
answered on 23 Feb 2018, 09:52 AM
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.
Tags
Window
Asked by
Tomaz
Top achievements
Rank 1
Answers by
Dave
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or