users@woodstock.java.net

Re: Accordion programmatically

From: Ratnadeep Bhattacharjee <Ratnadeep.Bhattacharjee_at_Sun.COM>
Date: Tue, 04 Dec 2007 07:59:58 -0500

Olle Mårtensson wrote:
> Hello,
>
> I'm trying to programmatically add tabs to an accordion component. When a
> tab is selected I want to display a tree component in the tab content area.
> I can add tabs without a problem but the tree is never displayed.
> Here's my code:
>
> @Override
> public void prerender() {
>
> accord.setLoadOnSelect(true);
> List accordChilds = getAccord().getChildren();
> for(Customer c : customerBeanBean.getAllCustomers()) {
> Tree tree = new Tree();
> List children = tree.getChildren();
> TreeNode node1 = new TreeNode();
> TreeNode node2 = new TreeNode();
> TreeNode node3 = new TreeNode();
> node1.setText(c.getCity());
> node2.setText(c.getEmail());
> node3.setText(c.getPhone());
> children.add(node1);
> children.add(node3);
> children.add(node2);
> // tabcontent
> TabContent content = new TabContent();
> List tabContentChildren = content.getChildren();
> tabContentChildren.add(tree);
> // tab
> AccordionTab tab = new AccordionTab();
> List tabChildren = tab.getTabChildren();
> tabChildren.add(tree);
> tab.setTitle(c.getName());
> accordChilds.add(tab);
> }

Why are you adding both TabContent and AccordionTab to the accordion -
it should be the latter. On the client side can you see the tree markup
   ? Also, try removing the loadOnSelect for now...

-Deep.

>
> }
>
>
>