Opened 7 years ago

Closed 7 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

  1. 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
  2. dojox.mobile.ListItem? constructs nested nodes buildRendering (direct descendant is "A").
  3. 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;

Change History (1)

comment:1 Changed 7 years ago by ykami

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.