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

Problem with finding open window (duplicate dom elements?)

1 Answer 161 Views
Window
This is a migrated thread and some comments may be shown as answers.
LARRY
Top achievements
Rank 1
LARRY asked on 09 Dec 2013, 07:09 PM
I am declaring a window like this...

in my html
<div id='mywin'></div>

in my js file...
        var window = $('#mywin');
        if (!window.data("kendoWindow")) {
            window.kendoWindow({
                width: winWidth + "px",
                height: winHeight + "px",
                minWidth: winWidth + "px",
                minHeight: winHeight + "px",
                title: "Place of Interest Search",
                actions: ["Close"],
                resizable: false
            });
        }

        //open identify window
        window.data("kendoWindow").center();
        window.data("kendoWindow").open();

this all works but when i attempt to reload content by...

    if ($("#mywin").data("kendoWindow")) {

        ..reload logic here


this ("#mywin").data("kendoWindow") always returns false thus recreating the window every time.

I notice in the dom there is the original div and then a duplicate div for the window at the bottom of the dom with the same id (mywin)

what am i doing wrong here? I want to reuse the original window without having to destroy it and recreate it.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Dec 2013, 01:41 PM
Hello,

I am not sure what could be causing another element with the same ID to be inserted in the DOM and I could not reproduce it on my side. Could you check this jsFiddle and let me know if I am missing something? Also, verify that you are not loading jQuery again. The widget instance will not be found in the element data if jQuery is loaded again after creating the window.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Window
Asked by
LARRY
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or