destroy window on close

6 posts, 0 answers
  1. Henk Jelt
    Henk Jelt avatar
    19 posts
    Member since:
    Jun 2012

    Posted 20 Jun 2012 Link to this post


    I create a window, which I would like to destroy after closing, but I cannot get it to work.

    I have found various hints in the forum, but if I implement them, the window keeps coming back after refreshing the screen (ie performing a feedback).

    The code which I use to initialize the window is pretty standard:
    		<script type="text/javascript">
    	 $(document).ready(function () {
    		$('#windows').css('z-index', 9000);
    			actions: [ "Maximize""Minimize""Close"],
    			draggable: true,
    			height: "600px",
    			modal: false,
    			resizable: true,
    			title: "<%=ViewData("paymentenginetext")%><%=  ViewData("invoicenr")%>",
    			width: "810px"
    		var kendoWindow = $("#Payment").data("kendoWindow");

    The way to destroy the window is to perform the function destroy at deactivation, but where and how do I put this in my code?


    Henk Jelt Hoving 
  2. Mickie
    Mickie avatar
    4 posts
    Member since:
    May 2012

    Posted 27 Jun 2012 Link to this post

    Hi Henk,

    I recently needed to implement a destroy after closing and put this together to play around with it (fyi there is some issue w/ this fiddle in IE but it works ok in Chrome and FF), maybe this will help you(?): 

    I'm seeing in the forums and documentation a recommendation that you do not need to destroy a window, particularly if you are going to use it again.  But in my case I needed to because we had implemented an edit form in a kendo window and found that if you opened the window, made some changes then closed the window without saving, the next time you opened the window - prior to the content being refreshed, you initially saw those last changes that you didn't save.  So, we wanted a way to be able to remove the window and its contents from the DOM and then later recreate it on click of an edit button.  (additional note: even though there is some issue w/ that fiddle in IE the technique works just fine in our app in all browsers)

        - Mickie
  3. Cary Abramoff
    Cary Abramoff avatar
    20 posts
    Member since:
    Aug 2009

    Posted 28 May 2013 Link to this post

    You just helped me make quick work of this issue with a simple copy & paste from your fiddle. Muchas Gracias.
  4. Mickie
    Mickie avatar
    4 posts
    Member since:
    May 2012

    Posted 05 Jun 2013 Link to this post

    Great - glad that was helpful to you!
  5. Tareq
    Tareq avatar
    2 posts
    Member since:
    Jun 2013

    Posted 10 Jul 2013 Link to this post

    Thanks Cary! that was very helpful. :)
  6. Bryan
    Bryan avatar
    1 posts
    Member since:
    Mar 2012

    Posted 07 Nov 2013 Link to this post

    Thanks Mickie, this was driving me crazy, too.   Creating a new element for the window as a container was the fix for me:

    $("#windowcontainer").append("<div id='window'></div>");
Back to Top