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

Close Window but Leaving Code in DOM

3 Answers 75 Views
Window
This is a migrated thread and some comments may be shown as answers.
peng
Top achievements
Rank 1
peng asked on 29 Oct 2008, 05:34 AM
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


3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 31 Oct 2008, 12:31 PM
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.
0
John
Top achievements
Rank 1
answered on 02 Apr 2009, 01:57 PM
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
0
Georgi Tunev
Telerik team
answered on 07 Apr 2009, 11:07 AM
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.
Tags
Window
Asked by
peng
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
John
Top achievements
Rank 1
Share this question
or