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

    ChoiceList in List based Table

    adfLearner
      Hi
      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}"+
      styleClass="AFStretchWidth">
      +<af:column sortable="false" headerText="col1" id="c1">+
      +<af:outputText value="#{row.id}" id="ot1"/>+

      +</af:column>+
      +<af:column sortable="false" headerText="col2" id="c2">+
      +<af:outputText value="#{row.name}" id="ot2"/>+
      +</af:column>+
      +<af:column sortable="false" headerText="col3" id="c3">+
      +<af:outputText value="#{row.deptId}" id="ot3"/>+
      +<af:selectOneChoice value="#{row.deptId}"+
      +label="#{bindings.DepartmentVO1.label}"+
      +required="#{bindings.DepartmentVO1.hints.mandatory}"+
      +shortDesc="#{bindings.DepartmentVO1.hints.tooltip}"+
      +id="soc1">+
      +<f:selectItems value="#{bindings.DepartmentVO1.items}" id="si1"/>+
      +</af:selectOneChoice>+
      +</af:column>+
      +<af:column sortable="false" headerText="col4" id="c4">+
      +<af:outputText value="#{row.departmentName}" id="ot4"/>+
      +</af:column>+
      +</af:table>+
      +</jsp:root>+

      Page Def code

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

      Thanks,
      Rajdeep
        • 1. Re: ChoiceList in List based Table
          vinod_t_krishnan
          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
            adfLearner
            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.
            THanks,
            Rajdeep
            • 3. Re: ChoiceList in List based Table
              vinod_t_krishnan
              iam asking you to do something like
                  public void deptLOVVCL(ValueChangeEvent valueChangeEvent) {
                      int index = (Integer)valueChangeEvent.getNewValue();
                    DCIteratorBinding dciterContainer =
                        (DCIteratorBinding)BindingContext.getCurrent().getCurrentBindingsEntry().get("DepartmentVO1Iterator");   
                    
                    //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
                      if(val.equals(index)){
                        //set the index
                        String depName = (String)ri.getAttribute("DepartmentName")
                        setDepartmentName(depName);
                        
                      }
                    
                  }
              }
              the mappign to departmentName is
              <af:column sortable="false" headerText="col4" id="c4">
              <af:outputText value="#{bean.departmentName}" id="ot4"/>
              </af:column>