final YuiGalleryContext Y = Y_.cast();
Accordion acc1 = Y.newAccordion(AccordionConfig.create().useAnimation(true).reorderItems(true));
acc1.render(parent);
AccordionItem item1 = Y.newAccordionItem(AccordionItemConfig.create().label("Item1, added from script").contentHeight("fixed", 80));
item1.set("bodyContent", "This is the body of the item, added dynamically to accordion.<br>Content height has been set as \"fixed, 80px\".");
acc1.addItem(item1);
AccordionItem item2 = Y.newAccordionItem(AccordionItemConfig.create().label("Item2, added from script").expanded(true).contentHeight("stretch").id("dinnode2"));
item2.set("bodyContent", "This is the body of the item, added dynamically to accordion, before item1.<br>Content height has been set as \"stretch\".");
acc1.addItem(item2);
AccordionItem item3 = Y.newAccordionItem(AccordionItemConfig.create().label("Item2, added from script").expanded(true).alwaysVisible(true).contentHeight("auto")
.id("dinnode3"));
item3.set("bodyContent",
"<div style='position:relative;'>This is the body of the item, added dynamically to accordion.<br>Content height has been set as \"auto\".</div>");
acc1.addItem(item3);
}
});