aspose file tools*
The moose likes JSF and the fly likes PrimeFaces dynamic cotextmenu and actions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "PrimeFaces dynamic cotextmenu and actions" Watch "PrimeFaces dynamic cotextmenu and actions" New topic
Author

PrimeFaces dynamic cotextmenu and actions

Gert Jan Kruizinga
Greenhorn

Joined: May 09, 2010
Posts: 16
Hi all,


I am working on a application using the context menu in the datatable from PrimeFaces 3.0.M4

If i define the context menu in the xhtml i can use the following:


But i need to generate the context menu from the backingbean, i use the following:


But MenuItem#addActionListener takes a class impementing ActionListener as parameter. How can i assign the dynamically generated menuItem to my simple method #{agenda.doEditButton} like i do from the xhtml?



Gert Jan Kruizinga.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

I don't think a direct linkage is possible there. More likely, you're going to have to build up some EL infrastructure and bind the actions as EL expressions just as you did in the raw XML version of the control definition. A bit ugly, but not an uncommon practice.


Customer surveys are for companies who didn't pay proper attention to begin with.
Gert Jan Kruizinga
Greenhorn

Joined: May 09, 2010
Posts: 16
Thank you for your answer Tim but i'm not sure that i understand it.

All i want to do is call the public method "doEditButton()" from my bean named "agenda" and you tell me that that is not (easely) possible from a dynamicly generated menu while it is common practice if i do it from xhtml?

I used the #{a.b} format to illustrate that i want to call that function, like i do in xhtml. does not work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PrimeFaces dynamic cotextmenu and actions