Man, this is taking way too long. I have the following. The line marked
with **** contains an @If. I set a breakpoint in showChildren() and
after it evaluates to true it doesn't get called by @If again (!?). This
basically means that if a menu item is selected then all of it's
children act as if they are selected too. I check the @IfBean source and
there doesn't seem to be any like caching or anything going on. I'm very
confused and help would be appreciated.

<renderblock jwcid="@RenderBlock" block="component:nav" />

<block jwcid="[EMAIL PROTECTED]" >
<ul>
        <for jwcid="@For" source="ognl:items" value="ognl:item">
                <li jwcid="@Any" class="ognl:cssClass">
                        <div><div><a jwcid="@DirectLink" 
listener="listener:selectAction"
parameters="ognl: { item.section, item.page}" id="ognl:item.id"><span
jwcid="@Insert" value="ognl:item.label" /></a></div></div>
                
****                    <span jwcid="@If" condition="ognl:showChildren()">
                                rendering children for <span jwcid="@Insert"
value="ognl:item.section" />
                                <renderblock jwcid="@RenderBlock" 
block="component:nav" />
                        </span>
                </li>
        </for>
</ul>
</block>

here is showChildren()

public boolean showChildren() {
        NavItem item = getItem();
        return item.isSelected() && item.hasChildren();
}


On Sat, 2005-11-05 at 00:02 +0200, Mind Bridge wrote:
> Hi,
> 
> The trick is in the following line:
> 
> <comp jwcid="@For" source="ognl:menuItems" value="ognl:menuItem">
> 
> Basically, the currently rendered node is placed in the menuItem 
> property and the getMenuItems() function must return the children of the 
> node currently in menuItem.
> 
> Here is some example code:
> 
>     public List getMenuItems() {
>         List items;
>         Customer item = getMenuItem();
>         // fill 'items' with the children of the 'item' node
>         if (item == null)
>             items = (List) personMap.get(new Integer(0));  // 0 is the root
>         else
>             items = (List) personMap.get(new Integer(item.getId()));
>         return items;
>     }
> 
> Also, please make sure you use a recent beta -- I am not sure your code 
> would work in an old one.
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to