2 Replies Latest reply on Apr 22, 2008 9:43 AM by ilya_shaikovsky

    RichDataGrid question

    roykachouh

      I have got the richDataGrid component working perfectly...

      The data grid contents consist of a string label and a select box. If i have 20 objects in a list that the datagrid displays and each object has a select item choice tied to it...

      What is the best way to bind the select item to a managed bean?

      Below is my code...i am trying to understand what I should put in the question mark section of the code...

      <rich:panel>
       <h:form>
       <rich:dataGrid value="#{DataGridTest.testList}" var="test" columns="3" elements="30">
       <rich:panel>
       <h:panelGrid columns="2">
       <h:selectOneListbox size="1" value="????????" styleClass="mySelectOne">
       <f:selectItems value="#{DataGridTest.selectItemList}"/>
       </h:selectOneListbox>
       <h:outputText value="#{test.label}" />
       </h:panelGrid>
       </rich:panel>
       </rich:dataGrid>
       <h:commandButton action="#{DataGridTest.test}" value="Submit"></h:commandButton>
       </h:form>
       </rich:panel>
      


        • 1. Re: RichDataGrid question
          roykachouh

          Ok, I think I found a way to handle my problem...although it's not the way I would of liked...

          It looks like I should bind the data grid component to an HtmlDataGrid property of my managed bean. Then inside my managed bean i can call HtmlDataGrid.getValue...this will return me a list of all the elements in the data grid. I can bind the select box choice to a property of the elements in the data grid...

          • 2. Re: RichDataGrid question
            ilya_shaikovsky

            it's much more simplier in general.

            As you use:

            <h:outputText value="#{test.label}" />
            


            In the same manner you could use

            <h:inputText value="#{test.label}" />
            


            or

            <h:select* value="#{test.label}" >
            ...
            


            inside dataGrid