3 Replies Latest reply on Aug 9, 2012 9:18 PM by vinod_t_krishnan

    ChoiceList in List based Table

      In the below scenario, I want my lov to show departmentName for deptId. Also I want to change the departmentName as user selects another department.

      I have this table on my page with select one choice on department. Note : table is showing the list ( from Bean )

      +<af:table var="row" rowBandingInterval="0" id="t1" value="#{pageFlowScope.testFlowBean.empList}"+
      +<af:column sortable="false" headerText="col1" id="c1">+
      +<af:outputText value="#{row.id}" id="ot1"/>+

      +<af:column sortable="false" headerText="col2" id="c2">+
      +<af:outputText value="#{row.name}" id="ot2"/>+
      +<af:column sortable="false" headerText="col3" id="c3">+
      +<af:outputText value="#{row.deptId}" id="ot3"/>+
      +<af:selectOneChoice value="#{row.deptId}"+
      +<f:selectItems value="#{bindings.DepartmentVO1.items}" id="si1"/>+
      +<af:column sortable="false" headerText="col4" id="c4">+
      +<af:outputText value="#{row.departmentName}" id="ot4"/>+

      Page Def code

      +<variableIterator id="variables"/>+
      +<iterator Binds="DepartmentVO1" RangeSize="25"+
      +DataControl="AppModuleDataControl" id="DepartmentVO1Iterator"/>+
      +<list IterBinding="DepartmentVO1Iterator" ListOperMode="navigation"+
      +ListIter="DepartmentVO1Iterator" id="DepartmentVO1"+
      +<Item Value="DepartmentId"/>+
      +<Item Value="DepartmentName"/>+

        • 1. Re: ChoiceList in List based Table
          1) bind the department name to the bean
          2) have a valuechangelistener.. for SOC
          3) in the value change listener get the department id. and then set the department name
          • 2. Re: ChoiceList in List based Table
            deptName is already binded to list in bean.

            In value changelistener how do i get deptName. As for each row we have lov displayed... i m not sure how can access the LOV collection for the selected Row.
            • 3. Re: ChoiceList in List based Table
              iam asking you to do something like
                  public void deptLOVVCL(ValueChangeEvent valueChangeEvent) {
                      int index = (Integer)valueChangeEvent.getNewValue();
                    DCIteratorBinding dciterContainer =
                    //Get the row set iterator
                    RowSetIterator  rs = dciterContainer.getRowSetIterator();
                    //Loop through the list to find the correct index
                    for(int i=0;i<rs.getRowCount();i++){
                    //Get the row at the index
                    Row ri = dciterContainer.getRowAtRangeIndex(i);
                    //Get the subcategory
                    String val = (String)ri.getAttribute("DepartmentId");
                      //is this equal to the actual value
                        //set the index
                        String depName = (String)ri.getAttribute("DepartmentName")
              the mappign to departmentName is
              <af:column sortable="false" headerText="col4" id="c4">
              <af:outputText value="#{bean.departmentName}" id="ot4"/>