I have seen both used in code but I was wondering what is the preferred and more efficient method of closing dialogs using dlg.hide() or dlg.destroyRecursive()?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That depends on whether you’re going to reuse the dialog or not. If it’s cheaper to just re-create it (you define what’s cheaper), use
destroyRecursive(). Otherwise, create once and justhide()it any time you need to close it.Keep in mind dijit will keep all the widgets you create in a registry. So simply letting the dialog variable go out of scope will not make it garbage collectable, and that opens up the possibility of a memory leak.