tags:

views:

237

answers:

1

Hi,

I've got a panel grid with a rich faces support object and underneath that an action parameter object.

<h:PanelGrid id="button" value="button1">
 |
 \-<a4j:support event="onclick" action="#{bean.doSomething}" >
 |       |
 |       \-<a4j:actionParameter value="1" assignTo="#{bean.currentlySelected}">
 |
 \-<a4j:ContextMenu>
    |
    \<menuItem .. DoSomethingWithSelectedButton ...>

The Idea - a button with an action for left click and a context menu for right click.

The action parameter lets the support tag know which button (panelgrid) is selected and perform an action on it in the backing bean.

I want to do the same for the context menu. meaning - use "currentlySelected" to decide which button the contextMenu was used in. But "currentlySelected" is only set when clicking the button and not the menuitems in the context menu.

I tried do add the existing actionParam as an eventListener for the menuitem but that didn't work. The other solution I thought of would be to create a new actionParam for each menuitem, but that seems a bit like a waste of resources.

I'm looking for a tip on the "smart" or the "correct" way of doing this.

Thanks!!!

+1  A: 

Try

<rich:menuItem ..>
    <a4j:support .. >
         <f:setPropertyActionListener target="#{bean.current}" value="1" />
    </a4j:support>
</rich:menuItem>
Bozho