Opened 10 years ago

Closed 9 years ago

#10004 closed defect (fixed)

AccordionContainer: doesn't render/setup correctly when populating from empty with addChld

Reported by: Sam Foster Owned by: bill
Priority: high Milestone: 1.5
Component: Dijit Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

If you start with an empty AccordionContainer (e.g. declaratively), then programatically add child panes with addChild, the async _transitions cause all the measurements to be off.

Incoming test case + patch

Attachments (1)

AccordionContainer_fromEmpty.html (6.5 KB) - added by Sam Foster 10 years ago.
[CLA] test page to show populate-from-empty problem and monkey-patched proposed solution

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Sam Foster

[CLA] test page to show populate-from-empty problem and monkey-patched proposed solution

comment:1 Changed 10 years ago by Sam Foster

The AccordionContainer_fromEmpty.html includes a monkey-patched _transition method, which looks to an _animateTransition boolean to either create and play the transition as before, or to simply and synchronously set the end-state properties.

In a from-empty scenario you can then do

ac._animateTransition = false; 
dojo.forEach([ "pane 1", "pane 2", "pane 3" ], function(title, i){
  var content = new dijit.layout.ContentPane({title: title});
  content.containerNode.innerHTML = "this is " + title;
  ac.addChild(content);
});
ac._animateTransition = true; 

This doesnt answer the question of what to do when addChild is being called repeatedly, I'm not sure we can know without providing a new method like addChildren, but it at least makes a minimal workaround possible.

comment:2 Changed 10 years ago by Adam Peller

Component: GeneralDijit
Owner: anonymous deleted

comment:3 Changed 10 years ago by bill

Description: modified (diff)
Milestone: tbd1.5
Owner: set to bill
Summary: AccordionContainer doesnt render/setup correctly when populating from empty with addChldAccordionContainer: doesn't render/setup correctly when populating from empty with addChld

I'm confused, I guess that _transition() is called on the first child added, and while it is running other children are being added, thus affecting the height the first child should expand to?

Seems like transitions caused by addChild() or removeChild() should render instantly, without any animation.

comment:4 Changed 9 years ago by bill

Resolution: fixed
Status: newclosed

(In [22143]) Don't do slide animation on addChild(), removeChild() or a programatically triggered selectChild() (as opposed to selecting a child by clicking it). Fixes #10004 !strict.

Note: See TracTickets for help on using tickets.