Problem with finding open window (duplicate dom elements?)

2 posts, 0 answers
  1. LARRY
    LARRY avatar
    3 posts
    Member since:
    Mar 2012

    Posted 09 Dec 2013 Link to this post

    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.
  2. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 11 Dec 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top