Opened 8 years ago
Closed 8 years ago
#14951 closed defect (wontfix)
dojox.mobile.ListItem cannot be added programatically via addChild function
Reported by: | marcinrybacki | Owned by: | ykami |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | DojoX Mobile | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
REPORT
- dojox.mobile.ListItem? implements Container mixin and addChild. AddChild? uses this.containerNode as a starting point to add nested widget. If this is not set explicitly
- dojox.mobile.ListItem? constructs nested nodes buildRendering (direct descendant is "A").
- When invoked addChild methods adds nodes under LI, but it should add nodes under "A".
SOLUTION: In the last lines of buildRendering function you have:
var a = this.anchorNode = domConstruct.create("A"); a.className = "mblListItemAnchor"; this.domNode.appendChild(a); a.appendChild(box);
There should be added last line:
this.containerNode = a;
So as a result this should be.
var a = this.anchorNode = domConstruct.create("A"); a.className = "mblListItemAnchor"; this.domNode.appendChild(a); a.appendChild(box); this.containerNode = a;
Note: See
TracTickets for help on using
tickets.
Thank you for the report. I can understand what you mean, but perhaps others may want to add a child to this.box rather than this.anchorNode. Unfortunately now I think inheriting from _Container was a design error. Actually, in version 1.8, ListItem no longer inherits from _Container. So I recommend you not to use addChild for ListItem. The placeAt() method can be used for that purpose.