开发者

Dojo, how destroy a custom widget?

开发者 https://www.devze.com 2023-04-07 23:00 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号