This content has been marked as final.
Show 5 replies
-
1. Re: Create the rich:dropDownMenu items dynamicly
nbelaevski Apr 29, 2009 10:01 AM (in response to mkuzmik)Hello,
Either use:
1. c:forEach tag
or:
2. Bind menu/group to some bean property, then call application.createComponent(UIMenuItem.COMPONENT_TYPE) to create menu items -
2. Re: Create the rich:dropDownMenu items dynamicly
mkuzmik Apr 29, 2009 9:02 PM (in response to mkuzmik)"nbelaevski" wrote:
Hello,
2. Bind menu/group to some bean property, then call application.createComponent(UIMenuItem.COMPONENT_TYPE) to create menu items
Can you give the examples? I don't underatand about "application.createComponent(UIMenuItem.COMPONENT_TYPE)". About create the bean all is ok - I just create java class take the @ on it. and than I can use it in my pages. In this class I will create menu rich:rich:dropDownMenu and all others nessasary components. But How after that I can put in inside rich:toolBar the on my pages?
So How can i Create dynamicly the next code and insert it into the tag rich:toolBar?<rich:dropDownMenu> <f:facet name="label"> <h:panelGroup> <h:outputText value="File"/> </h:panelGroup> </f:facet> <rich:menuItem submitMode="ajax" value="#{messages['label.logout']}" action="#{identity.logout}" /> </rich:dropDownMenu> <rich:dropDownMenu> <f:facet name="label"> <h:panelGrid cellpadding="0" cellspacing="0" columns="2" style="vertical-align:middle"> <h:outputText value="Help" /> </h:panelGrid> </f:facet> <rich:menuItem submitMode="ajax" value="About..." action="" /> </rich:dropDownMenu>
-
3. Re: Create the rich:dropDownMenu items dynamicly
nbelaevski Apr 30, 2009 1:34 AM (in response to mkuzmik)1.
<rich:toolBar binding="{bean.toolbar}" />
"bean" should not be application, session or conversation-scoped. "bean.toolbar" is of type javax.faces.component.UIComponent
2. In the bean do the following:if (toolbar.getChildCount() == 0) { UIDropDownMenu menu = (UIDropDownMenu) application.createComponent(UIDropDownMenu.COMPONENT_TYPE); //fill in attributes - read more about UIComponent/ValueExpression/MethodExpression types in JSF spec./Javadocs .. //create rest of components toolbar.getChildren().add(item); }
-
4. Re: Create the rich:dropDownMenu items dynamicly
mkuzmik Apr 30, 2009 4:51 AM (in response to mkuzmik)What method must be in my bean? i don't undertand =( Sorry, but i'm beginner in RichFaces.
-
5. Re: Create the rich:dropDownMenu items dynamicly
nbelaevski Apr 30, 2009 10:03 AM (in response to mkuzmik)public UIToolBar getToolbar() { if (toolbar == null) { toolbar = (UIToolBar) application.createComponent(UIToolBar.COMPONENT_TYPE); UIDropDownMenu menu = (UIDropDownMenu) application.createComponent(UIDropDownMenu.COMPONENT_TYPE); //fill in attributes - read more about UIComponent/ValueExpression/MethodExpression types in JSF spec./Javadocs .. //create rest of components toolbar.getChildren().add(item); } }