-
1. Re: Dynamic DropDownMenu
paul.dijou Dec 6, 2011 5:38 AM (in response to lobo369)Shouldn't you use the "label" attribute instead of the "value" attribute in a dropDownMenu ? (or at least a "label" facet) Also, you can try to add some menuItem in each dropDownMenu just to be sure.
-
2. Re: Dynamic DropDownMenu
lobo369 Dec 6, 2011 10:02 AM (in response to paul.dijou)Thank's Paul for your suggestion, but It isn't work to me. I don't understand why. I tried use a laber property and label facet with the same results.
Originally I only wanted to put dynamic ItemMenu but I with the same behavor, then I decided to build all the dropdownmenu dynamically.
I tried to binding a HtmlDropDownMenu but no way. The component never been rendered.
Any other suggestion ?
-
3. Re: Dynamic DropDownMenu
paul.dijou Dec 6, 2011 10:35 AM (in response to lobo369)1 of 1 people found this helpfulFirst, my bad, there is not "label" attribute for dropDownMenu in RichFaces 3.x, this is a 4.x feature. So you were totally correct with your "value" attribute. Really sorry.
I will just insist a bit. When I take a look at that demo, it seems that the toolbar has no problem with a c:forEach inside of it. In addition, in your screenshot, there is a few line separators even before the "Menu 4" label indicating that, maybe, it's trying to add something but quite empty. You can try a few steps :
1) Replace your dropDownMenu with a "<h:outputText value="Test"/>" and see if the iteration is correct and the labels printed (as many as reportes.barra.menus.size()).
2) Replace the outputText with : "<h:outputText value="#{itemmenu.text}"/>". This will check if the "getText()" method is correctly define in the "itemmenu" var.
3) If it's fine, try to replace this outputText with :
<rich:dropDownMenu> <f:facet name="label"> <h:outputText value="File"/> </f:facet> <rich:menuItem value="New" action="test" /> <rich:menuItem value="Open" action="test"/> </rich:dropDownMenu>
And see if it creates you several dropDownMenu (as many as reportes.barra.menus.size()), all the same of course.
4) If it still works, you can replace the "File" value on the h:outputText in the "label" facet with your #{itemmenu.text}.
5) Down know if you will arrive to this step, but if you do, then remove the two "rich:menuItem". Still working ?
Hope this could help to better understand your problem.
Just for information, here is how the RichFaces 4.x showcase menu is dynamicly build : http://anonsvn.jboss.org/repos/richfaces/trunk/examples/richfaces-showcase/src/main/webapp/templates/includes/navigation.xhtml
Not exactly the same as your, but maybe it could help...
-
4. Re: Dynamic DropDownMenu
lobo369 Dec 6, 2011 9:23 PM (in response to paul.dijou)Thanks a lot Paul.
I followed your steps and identified the problem.
The <c:foreach> didn't work to me because I was traing use JSTL for jsp with facelets.
I changed the taglib and all came to work fine :-)
The correct taglib to use with facelets is xmlns:c="http://java.sun.com/jstl/core" insted of xmlns:c="http://java.sun.com/jsp/jstl/core"