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

    RichDataGrid question

    roy kachouh Newbie

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

        • 1. Re: RichDataGrid question
          roy kachouh Newbie

          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 Master

            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}" />


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

            inside dataGrid