0 Replies Latest reply on Apr 4, 2013 2:39 AM by maran_su

    How To Bring The Value in DropDown  when Dynamic Row Adding in Rich:DataTable

    maran_su

      Hi ,

       

             I am trying to add the Row  in rich:dataTable when i click the add button, i am succesfull abl to Add and remove the row.

      my requirment is  Each New Row contains 5 DropDown with values from Bean class.

       

      see the below code it is working with out value from bean class.

      <rich:dataTable id="tpp_data" rows="10" value="#{tppAction.getListOfObjects()}" var="lo" columnClasses="col">

                <rich:column>

                <h:selectOneMenu id="comparator">

                    <f:selectItem itemLabel="Choose" itemValue="null" />

                 </h:selectOneMenu>

                </rich:column>

                <rich:column>

                  <h:selectOneMenu id="company">

                         <f:selectItem itemLabel="Choose" itemValue="null" />

                 </h:selectOneMenu>

                </rich:column>

                <rich:column>

                    <h:selectOneMenu id="admin">

                            <f:selectItem itemLabel="Choose" itemValue="null" />

                    </h:selectOneMenu>

                </rich:column>

                <rich:column>

                         <h:selectOneMenu id="tolerance">

                                   <f:selectItem itemLabel="Choose" itemValue="null" />

                       </h:selectOneMenu>

                </rich:column>

                <rich:column>

                    <h:selectOneMenu id="market">

                            <f:selectItem itemLabel="Choose" itemValue="null" />

                    </h:selectOneMenu>

                </rich:column>

      </rich:dataTable>

      <h:panelGroup style="display:block; text-align:center">

                                                 <h:commandButton value="+" action="#{tppAction.add()}" reRender="tpp_data" />

                                                 <h:commandButton value="-"   action="#{tppAction.remove()}" reRender="tpp_data"/>

                                             </h:panelGroup>

                                                        <rich:dataScroller for="tpp_data" maxPages="10"

                                                                  styleClass="pagination-center" />

                                              </a4j:outputPanel>

       

       

      ---------------------------------------------------------------------------------------------------------

       

      my Bean Class

       

       

      public void add() {

                          

                           TppDetail tppDetail=new TppDetail();

                           listOfObjects.add(tppDetail);

       

                }

       

                public List<TppDetail> getListOfObjects() {

                          return listOfObjects;

                }

       

      -------------------------------------------------------------------------------------------------------------

       

       

      But If I call the bean class to get the values for DropDown in the rich:column i am not able to add more than one row it shows following error.

       

      14:20:45,243 INFO  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.

      sourceId=pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:comparator[severity=(ERROR 2), summary=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:comparator: 'null' must be a number consisting of one or more digits.), detail=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:comparator: 'null' must be a number between -2147483648 and 2147483647 Example: 9346)]

      sourceId=pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:company[severity=(ERROR 2), summary=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:company: 'null' must be a number consisting of one or more digits.), detail=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:company: 'null' must be a number between -2147483648 and 2147483647 Example: 9346)]

      sourceId=pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:admin[severity=(ERROR 2), summary=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:admin: 'null' must be a number consisting of one or more digits.), detail=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:admin: 'null' must be a number between -2147483648 and 2147483647 Example: 9346)]

      sourceId=pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:tolerance[severity=(ERROR 2), summary=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:tolerance: 'null' must be a number consisting of one or more digits.), detail=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:tolerance: 'null' must be a number between -2147483648 and 2147483647 Example: 9346)]

      sourceId=pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:market[severity=(ERROR 2), summary=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:market: 'null' must be a number consisting of one or more digits.), detail=(pbG513d351d_2d33ba_2d48ab_2dbae4_2db12de6e1c969_j_id1:multipleAppForm:tpp_data:0:market: 'null' must be a number between -2147483648 and 2147483647 Example: 9346)]

       

      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

       

      The code additinally added are below. highlighted in Bold

       

      <rich:dataTable id="tpp_data" rows="10" value="#{tppAction.getListOfObjects()}" var="lo" columnClasses="col">

                <rich:column>

                          <h:selectOneMenu  id="comparator"  value="#{lo.approvedTherapyId}"  >

                                                      <f:selectItem itemLabel="Choose" itemValue="null" />

                     <f:selectItems  value="#{tppAction.allAppTherapy}" var="t"

                                       itemLabel="#{t.approved_therapy_name}" itemValue="#{t.approved_therapy_id}" />

                </rich:column>

                <rich:column>

                          <h:selectOneMenu id="company">

                                    <f:selectItem itemLabel="Choose" itemValue="null" />

                          </h:selectOneMenu>

                </rich:column>

                <rich:column>

                          <h:selectOneMenu id="admin">

                                    <f:selectItem itemLabel="Choose" itemValue="null" />

                          </h:selectOneMenu>

                </rich:column>

                <rich:column>

                          <h:selectOneMenu id="tolerance">

                                    <f:selectItem itemLabel="Choose" itemValue="null" />

                          </h:selectOneMenu>

                </rich:column>

                <rich:column>

                          <h:selectOneMenu id="market">

                                    <f:selectItem itemLabel="Choose" itemValue="null" />

                          </h:selectOneMenu>

                </rich:column>

      </rich:dataTable>

       

      ---------------------------------------------------------------------------------------------------------

       

      My question is How can i bring the value when i click the AddRow button

       

       

      can any one suggest solution for me.

       

      Below Attached the screen shots

       

      DynamicDropDownWhenAdd.png is taken when i dont' have any value inside DropDown

       

      NotAbletoAddmoreThaOneRow.png taken when i added value for Drop Down.