Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#410 closed defect (fixed)

ContentPane needs to add new widgets as children

Reported by: cris@… Owned by: anonymous
Priority: high Milestone:
Component: Widgets Version: 0.2
Keywords: widget layout ContentPane Cc:
Blocked By: Blocking:

Description

ContentPane? currently parses widgets but does not add them as its children (in setUrl). This means that things like layouts do not work properly.

Here is a patch that has helped me. It probably needs work from someone more knowledgeable, and it certainly needs review before being committed.

--- ContentPane.js.31   2006-02-03 11:50:43.000000000 -0800
+++ ContentPane.js      2006-02-03 11:51:04.000000000 -0800
@@ -94,15 +94,31 @@
 
        setContent: function(data){
                var node = this.containerNode || this.domNode;
+                for (var i=0; i<this.children.length; i++) {
+                  var child = this.children[i];
+                  this.removeChild(child);
+                  child.destroy();
+                }
                node.innerHTML = data;
                if(this.parseContent) {
                        var parser = new dojo.xml.Parse();
                        var frag = parser.parseElement(node, null, true);
-                       dojo.widget.getParser().createComponents(frag);
+                  var results = dojo.widget.getParser().createComponents(frag);
+                  this.registerWidgets(results);
                        this.onResized();
                }
        },
 
+        registerWidgets: function(widget){
+          if (widget instanceof Array) {
+            for (var i=0; i<widget.length; i++) {
+              this.registerWidgets(widget[i]);
+            }
+          } else if (widget.widgetType) {
+            this.registerChild(widget, this.children.length);
+          }
+        },
+
        // Generate pane content from given java function
        setHandler: function(handler) {
                var fcn = dojo.lang.isFunction(handler) ? handler : window[handler];

Change History (3)

comment:1 Changed 14 years ago by bill

Resolution: fixed
Status: newclosed

rev #3018

comment:2 Changed 14 years ago by alex

Milestone: 0.3release

comment:3 Changed 12 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.