programmatic menu set rendered condition strings

UI Components for JSF
Post Reply
jaga
Posts: 4
Joined: 07 Mar 2014, 15:05
Location: Medellín - Colombia
Contact:

07 Feb 2017, 18:17

programmatic menu set rendered condition strings

for example: item.setRendered="#{bean.isDisabled}",

model = new DefaultMenuModel();

//First submenu
DefaultSubMenu firstSubmenu = new DefaultSubMenu("Dynamic Submenu");

DefaultMenuItem item = new DefaultMenuItem("External");
item.setUrl("http://www.primefaces.org");
item.setIcon("ui-icon-home");

item.setRendered="#{bean.isDisabled}" // Can someone help me ??

firstSubmenu.addElement(item);


model.addElement(firstSubmenu);
Translate Google

Miguel Cubells
Posts: 99
Joined: 25 Feb 2015, 11:02

10 Feb 2017, 03:16

If your "bean" is a View Scoped bean, or Session bean, I guess you could just try to inject it into your current Java class (the one that is building the menu) ?
PrimeFaces 6.1 / PF Extensions 6.1.1 / Atmosphere 2.4.3
Apache Mojarra 2.2.13+
WildFly 10.1.0.Final

jaga
Posts: 4
Joined: 07 Mar 2014, 15:05
Location: Medellín - Colombia
Contact:

14 Feb 2017, 23:42

If so, but it is more practical to send a string, primefaces does not have that option. only boolean for programaatic menu :(

Translate Google
Translate Google

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

16 Feb 2017, 03:12

No Miguel is correct. You need to do..

Code: Select all

item.setRendered(bean.isDisabled());
in the Java code. Do you not have access to "bean" on the server side?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 21 guests