Opened 13 years ago
Closed 13 years ago
#6965 closed defect (fixed)
Error: w.destroy is not a function
Reported by: | guest | Owned by: | alex |
---|---|---|---|
Priority: | high | Milestone: | 1.2 |
Component: | Dijit | Version: | 1.1.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
My widget template contains the following:
<div dojoType="dojo.data.ItemFileReadStore?" jsId="pdiTrustStore" url="/imr/options.dojo?bean=pdiTrustOptions&value=identity"></div>
This works fine in dojo 1.0.2, but 1.1.1 generates an error when the widget is destroyed:
w.destroy is not a function
/imr/js/dojo-release-1.1.1/dojo/../dijit/_Widget.js Line 208
I believe w.destroy() (in destroy() in _Widget.js) should be called only if the widget contains the destroy method.
destroy widgets created as part of template, etc.
[], function(w){ w.destroy(); }); |
Please help how to handle this error.
Change History (4)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Milestone: | → 1.2 |
---|---|
Owner: | set to alex |
Priority: | highest → normal |
severity: | blocker → major |
Status: | new → assigned |
comment:3 Changed 13 years ago by
Nathan:
I think it's reasonable to assume that what you can declare in markup regularly you should be able to do in a template, and insofar as this is clearly a regression, it should be fixed on that basis alone. Dojo's markup system supports creating all kinds of classes declaratively, including things that aren't "widgets"...that's a feature, not a bug, and something we need to fix.
Regards
comment:4 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I have encountered this error - and it's actually quite helpful to have the destroy function behave as it currently does. I have found many times where I was not properly cleaning up things.
I would suggest *NOT* putting non-widget declarations within a widget template. In this case, you can accomplish the same thing by just creating an ItemFileReadStore? in your postCreate function of your widget:
If you need this *before* other widgets are created, you could put it in your postMixInProperties function instead.
That would keep your widget from trying to call destroy() on the store - since the store really *isn't* a widget.