Opened 14 years ago
Closed 14 years ago
#3513 closed defect (fixed)
dojoAttachEvent problem within ContentPane
Reported by: | guest | Owned by: | liucougar |
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | Dijit | Version: | 0.9 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
0.9 nightly 24/06/07 I have a custom templated widget that uses a content pane within the template Something like this:
Test.html
<div> <div dojoType="dijit.layout.ContentPane" sizeMin="20" sizeShare="20" id="pageViewer"> <button dojoAttachEvent="onclick:addPage">Test</button> </div></div>
Test.js
if(!dojo._hasResource["foo.Test"]){ dojo._hasResource["foo.Test"] = true; dojo.provide("foo.Test"); dojo.require("dijit.layout.ContentPane"); dojo.require("dijit._Widget"); dojo.require("dijit._Templated"); dojo.declare( "foo.Test", [dijit._Widget, dijit._Templated], { templatePath:"dojotoolkit/foo/templates/Test.html", widgetsInTemplate:true, addPage: function() { alert("bar"); } } );
When clicking on the button displayed nothing happens. However, if I remove the content pane widget clicking on the button brings up the alert box.
It's as if nested dojoAttachEvent attributes are not being processed.
The actual use case for this scenario is when a widget contains a dialog where the controls affect the containee widget.
Affects Firefox and IE 7.
Attachments (1)
Change History (7)
comment:1 Changed 14 years ago by
Changed 14 years ago by
Attachment: | _attachTemplateNodes.txt added |
---|
comment:2 Changed 14 years ago by
Please ignore the following from the above change:
'Even if the widget does not contain any widgets it still needs to process dojoAttachPoint and dojoAttachEvent attributes'
comment:3 Changed 14 years ago by
I have done some further development and come up with the following for suggestion 1 above.
if(baseNode[tevt] || baseNode["domNode"] == null) { //All widgets where the target method exists or all non widgets this.connect(baseNode, tevt, thisFunc); } else { //All widgets where target event does not exist this.connect(baseNode.domNode, tevt, thisFunc); }
comment:4 Changed 14 years ago by
Milestone: | → 1.0 |
---|---|
Owner: | changed from bill to liucougar |
I don't think this is intended to be supported. Cougar, what do you think?
comment:5 Changed 14 years ago by
Looks like suggestion 2 has been fixed in the 0.9 beta. Suggestion 1 desn't really pertain to this bug, I'll open a separate enhancement ticket with full justification there.
comment:6 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I have a couple of suggestions although I appreciate that the behaviour that I am seeing could be by design, in which case please just close this bug:
In dijit._Templated._attachTemplateNodes:
Even if the widget does not contain any widgets it still needs to process dojoAttachPoint and dojoAttachEvent attributes
currently short circuits the function if a widget is encountered, however that widget could be a container widget and will need its child nodes processed. Therefore the logic can be changed to:
I have attached the fully modified version of this method.