• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

PrimeFaces dynamic cotextmenu and actions

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 28227
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Get out of my mind! Look! A tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic