Dojo, how destroy a custom widget?
I have create开发者_开发百科d a custom dijit widget which contains a grid and some buttons.
What is the right way to destroy it? override uninitialize, destroy, destroyRecursive? which method and in which order?
Thanks.
Generally uninitialize
is the best place to do this, since it is an extension point called within the destroy
function before other teardown occurs.
That said, depending on how you are adding your child widgets, you may not actually have to do anything. For instance, if you are defining your child widgets within a template, widgets declared within a template automatically get added to an array which is iterated through in destroy
.
If you wanted to be sure, for testing you could connect to the destroy
methods of your child widgets to log a message when they get called.
精彩评论