acanimal
acanimal

Reputation: 5020

Dojo, how destroy a custom widget?

I have created 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.

Upvotes: 0

Views: 1473

Answers (1)

Ken Franqueiro
Ken Franqueiro

Reputation: 10559

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.

Upvotes: 2

Related Questions