Dojo,如何销毁自定义窗口小部件? [英] Dojo, how destroy a custom widget?

查看:67
本文介绍了Dojo,如何销毁自定义窗口小部件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义的dijit小部件,其中包含一个网格和一些按钮.

I have created a custom dijit widget which contains a grid and some buttons.

销毁它的正确方法是什么?覆盖未初始化,销毁,destroyRecursive?哪种方法和顺序?

What is the right way to destroy it? override uninitialize, destroy, destroyRecursive? which method and in which order?

谢谢.

推荐答案

通常 uninitialize 是执行此操作的最佳位置,因为它是 destroy 在其他拆卸发生之前起作用.

Generally uninitialize is the best place to do this, since it is an extension point called within the destroy function before other teardown occurs.

也就是说,根据您添加子窗口小部件的方式,您实际上可能无需执行任何操作.例如,如果要在模板中定义子窗口小部件,则在模板中声明的窗口小部件会自动添加到在 destroy 中进行迭代的数组中.

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.

如果您想确定一下,可以进行测试以连接到子小部件的 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.

这篇关于Dojo,如何销毁自定义窗口小部件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆