Menu

#1 MenuItem id unique in loops

open
nobody
None
5
2005-03-03
2005-03-03
Anonymous
No

I generate in my template some menuItems in a loop:

ForEach:
<DIV jwcid="@menu:MenuItem" ... @DirecLink ...

Because the 'id' in the template is always the same,
the code does not work.

My solution was an optional parameter 'menuId' in the
MenuItem.jwc with an default-Id.

<parameter name="menuId" type="java.lang.String"
required="no" default-value='"defaultMenuId"'
direction="in" />

Then I changed the MenuItem.html template:

<span jwcid="@Script"
script="/org/krysalis/menu/component/MenuItem.script"
id="ognl:id + menuId"

submenuid="ognl:submenuId"/>
<tr class="menuItem" id="ognl:'menu' + id + menuId"
jwcid="@Any">...

As you see I appended the 'menuId' twice.

Now it works fine.

Discussion


Log in to post a comment.