Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PrimeFaces dynamic cotextmenu and actions

 
Gert Jan Kruizinga
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gert Jan Kruizinga
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic