hi there,
i'm trying to implement a dynamicly created contextmenu, called from within a datatable.
my problem is
(a) i dont get my code to work on the oncontextmenu
event
(b) i dont get the right property in my backing bean
here is the relevant code-snippet (taken and modified from max katz's practical richfaces
, chapter 9, menu components):
<rich:datatable...> ... <rich:contextMenu submitMode="ajax" id="cm" binding="#{contextMenuHelper.contextMenu}"/> ... <rich:column <f:facet name="header"> ... </f:facet> <h:graphicImage ... /> <rich:toolTip... /> <a4j:support event="oncontextmenu" oncomplete="#{rich:component('cm')}.doShow(event, {})" actionListener="#{myAction.myListener}" reRender="cm" > <f:setPropertyActionListener value="#{myItem}" target="#{myAction.item}" /> </a4j:support> </rich:column> ... </rich:datatable>
(the contextMenuHelper is EVENT-scoped and holds the dynamically rendered context-menu)
Okay, back to my problems:
- if i rightclick in the column, no methods are called at all, and i get a tiny, empty context-menu (just 2 pixels or so)
- if i change the event of the a4j-support to onclick
, the a4j action listener is called, but before the property action listener sets its value - obviously resulting in a NPE
- if i change my bean-code to be NPE-safe, for the sake of the example, i see that the context menu is dynamically created, but not for actual clicked data row, but for the last one... (as expected)
any ideas what is wrong?
cheers,
jan