Close Window but Leaving Code in DOM

4 posts, 0 answers
  1. peng
    peng avatar
    3 posts
    Member since:
    Oct 2008

    Posted 29 Oct 2008 Link to this post

    hi,
    I have a question.When i opened an RadWindow and closed it,the window will last about 83line html code in the DOM.If i use it to build a SPA ,it will be a terrible thing,client call the window many times and the browser will process many data on the client,in some extreme case,the browser will stop response.Of course ,it could not be happen,so is there some reson to leave the html code in the DOM or i misuse it?

    p.s.The rad example do the same.
    version:RadControls for ASPNET AJAX Q1 2008


  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 31 Oct 2008 Link to this post

    Hi peng,

    Once created on the client RadWindow is cached and can be reused many times - that is why it stays in the DOM. If you experience any problems with RadWindow in your scenario, please open a support ticket and send us a project that we can run and examine on our side. We will check it and help you right away.



    Regards,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. John
    John avatar
    25 posts
    Member since:
    Feb 2008

    Posted 02 Apr 2009 Link to this post

    Hi Georgi,

    Is it possible to circumvent this behaviour. All of our modal dialogs are configured dynamically, and its possible to show nested modal dialogs. In a fairly short space of time the Dom gets littered with lots of radWindow markup that will never be used again (not to mention the associated background overlays). I thought setting DestroyOnClose = true would remove them from the DOM, but this doesn't seem to be the case. I have no requirement to keep them around, so would really like to be able to clear them out of the DOM once the window is closed. Is this possible (we are currently using build 2008.2.836.35), I've searched the API but cannot find anything that appears to do this.
    I could get around this issue by having a "pool" of static radWindows in the markup and "freeing" them up when a radWindow closes, then reusing them with new content. But as we theoretically allow an arbitrary depth of nesting then this places an artifical restriction on this. Ideally I would like to create them dynamically using radopen or whatever, then having them disappear from the DOM when the user closes them.

    Many Thanks,

    John Rhodes
  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 07 Apr 2009 Link to this post

    Hello John,

    You could do this by using the OnClientClose eventhandler and remove the window's popup element there:

    function OnClientClose(oWnd) 
        var popup = oWnd.get_popupElement(); 
        popup.parentNode.removeChild(popup); 

    This functionality is already implemented in recent versions of the control - if you upgrade to a recent version, you will not need to use the code above.

    Greetings,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top