hi,
i am trying to create a context menu on a treenode and pass the "something" to the contextMenu actionListener...
By something i mean either
1) anything value client javascript
2) or better: a attribute of the treenode
3) or even better: the object (bean) wrapped by the treenode
i was experimenting with this quite a time now, my code looks like this so far:
. . . <rich:treeNode type="category" acceptedTypes="course" nodeClass="node category_node" selectedClass="node_active" iconLeaf="webresources/images/courseTree/category.gif" > <h:outputText value="#{item.name}" /> <rich:componentControl event="oncontextmenu" for="categoryContextMenu" operation="show"> <f:param value="#{item.name}" name="name" /> </rich:componentControl> </rich:treeNode> . . . <rich:contextMenu attached="false" id="categoryContextMenu" submitMode="ajax"> <rich:menuItem ajaxSingle="true" submitMode="ajax" actionListener="#{CourseTreeJsfBean.editCategory}">{name} Bearbeiten <a4j:actionparam name="iris" assignTo="#{CourseTreeJsfBean.iris}" value="{name}"/> </rich:menuItem> <rich:menuItem ajaxSingle="true">Löschen</rich:menuItem> <rich:menuItem ajaxSingle="true">Kurs erstellen</rich:menuItem> </rich:contextMenu> . . .
public class CourseTreeJsfBean { . . . private String iris; . . . public void editCategory(ActionEvent event) { HtmlMenuItem item = (HtmlMenuItem) event.getComponent(); } . . . }