Problems with adding/removing ContentPanes in Acco

2019-08-11 16:01发布

问题:

I'm a complete newbie at Dojo, and Adobe AIR, which is my target. I'm trying to put some panes into an AccordionContainer like so:

var mainview = dijit.byId("mainview");
var rand = randomString();
var widg = gtd_create_entry_widget(rand)
air.trace(mainview);
air.trace(widg);
mainview.addChild(widg);

"mainview" is my AccordionContainer, and gtd_create_entry_widget() is:

function gtd_create_entry_widget(id) {

   var entry = new dijit.layout.ContentPane();
   entry.attr("id",id);
   entry.attr("title","title "+id);
   return entry;

}

The pane shows up in the container, with the correct id and title, and no errors, however, if I try to add another pane, the next one shows up too, but I get the error:

TypeError: Result of expression '_7' [undefined] is not an object.

I get the same error if I run

var mainview = dijit.byId("mainview");
mainview.destroyDescendants();

and also, only one pane is destroyed at a time, and I understand this method should destroy all the children.

I can include full project code if required.

Thanks a lot

Garry

回答1:

I'm not exactly sure if this is going to fix your problem, but you're supposed to use dijit.layout.AccordianPane (http://www.dojotoolkit.org/api/dijit/layout/AccordionPane.html) with the AccordianContainer.



标签: dojo