Opened 13 years ago

Closed 7 years ago

#1983 closed feature (fixed)

widgetsInTemplate does not process nested widgets

Reported by: joao.paulo.barbosa@… Owned by: liucougar
Priority: low Milestone: 1.0
Component: Dijit Version: 0.4
Keywords: widgetsInTemplate sub widgets Cc:
Blocked By: Blocking:

Description (last modified by bill)

Sub widgets that are wrapped by, for instance, accordion panes or split panes, aren't processed. So dojoAttachPoint or dojoAttachEvent are ignored for those sub widgets.

I fixed by setting an attribute on nodes (watermark) and then check for the mark. If there is no mark, then its a wrapper widget (or something like that), so lets process its children.

On DomWidget?.js near line 586 I made:

if(subnodes[i].getAttribute('dojoType')){
  subnodes[i].setAttribute('_isSubWidget', true);
}
subnodes[i].setAttribute('_watermark', true);

and near line 618 change to:

if(cwidget.extraArgs['_watermark'] &&
   (cwidget._processedSubWidgets || !cwidget.extraArgs['_issubwidget'])){ continue; }

Attachments (4)

test_widgetsInTemplate.html (9.0 KB) - added by promag 13 years ago.
test_widgetsInTemplate.2.html (9.3 KB) - added by promag 13 years ago.
test_widgetsInTemplate.3.html (5.4 KB) - added by promag 13 years ago.
This simple test shows that wrapped sub widgets aren't attached
widgetsInTemplate1.0.html (8.8 KB) - added by bill 7 years ago.
test case updated to run against 1.0 (and 1.9)

Download all attachments as: .zip

Change History (14)

comment:1 Changed 13 years ago by bill

You need to supply a testcase w/javascript file, template file, and test html file.

Changed 13 years ago by promag

Attachment: test_widgetsInTemplate.html added

Changed 13 years ago by promag

Changed 13 years ago by promag

This simple test shows that wrapped sub widgets aren't attached

comment:2 Changed 13 years ago by dylan

Component: GeneralWidgets
Milestone: 0.9
Owner: changed from anonymous to bill

comment:3 Changed 12 years ago by bill

Component: WidgetsDijit
Milestone: 0.91.0
Owner: changed from bill to liucougar

comment:4 Changed 12 years ago by bill

Milestone: 1.02.0

comment:5 Changed 12 years ago by alex

Milestone: 2.01.3

Milestone 2.0 deleted

comment:6 Changed 11 years ago by bill

Description: modified (diff)
Milestone: 1.3future
Summary: widgetsInTemplate does not process new widgets created dynamicallywidgetsInTemplate does not process nested widgets
Type: defectenhancement

I've got a feeling that we will switch to using the DTL code before addressing this issue.

For now, you just need to workaround by creating widgets like the TabContainer and it's children programatically, and then attaching them under your widget.

comment:7 Changed 7 years ago by bill

Priority: highlow

comment:8 Changed 7 years ago by dylan

Resolution: wontfix
Status: newclosed

There are many solutions, but also some challenges with nested or subwidgets.

I'm going to close this as wontfix, because I think we've gone as far as we can reasonably go with the approach to nesting widgets in the 1.x codebase.

comment:9 Changed 7 years ago by bill

Resolution: wontfix
Status: closedreopened

This is still something I want to look at, although not for 1.9.

comment:10 Changed 7 years ago by bill

Milestone: future1.0
Resolution: fixed
Status: reopenedclosed
Type: enhancementfeature

Actually, this already works well, and I think it's worked since 1.0. The only failures in the test case, when updated for 1.0, are:

  1. The infinite recursion test (test 2): we aren't supposed to support that.
  2. The dojoAttachPoint inside the button (in test 3). The way dijit/form/Button::_fillContent() copies the srcNodeRef.innerHTML to this.label isn't compatible with having dojoAttachPoint inside a button.

Changed 7 years ago by bill

Attachment: widgetsInTemplate1.0.html added

test case updated to run against 1.0 (and 1.9)

Note: See TracTickets for help on using tickets.