5 Replies Latest reply: Apr 19, 2012 11:19 AM by makel RSS

    Filtering model driven LOV

    Ferez
      I have used the instructions here to filter a model driven LOV but it seems that it doesn't work. I am stuck and I really appreciate your help.
      http://www.oracle.com/technetwork/developer-tools/adf/learnmore/44-restrict-lov-169186.pdf

      Here is my LOV attribute:

      <af:inputListOfValues id="MsMenusTreeMenuCode"
      popupTitle="#{nls['SEARCH_AND_SELECT']}"
      searchDesc="#{nls['SEARCH_AND_SELECT']}"
      value="#{bindings.MsMenusTreeMenuCode.inputValue}"
      label="#{nls['MSMENUSTREE_MENUCODE']}"
      showRequired="false" columns="6"
      maximumLength="5"
      readOnly="true"
      shortDesc="#{nls['MSMENUSTREE_MENUCODE_HINT']}"
      autoSubmit="true"
      valueChangeListener="#{MsMenusTreeMenuCodeDependsOnItem.updateModelValue}"
      launchPopupListener="#{LovBean.onLovLoadParentMenu}"
      model="#{bindings.MsMenusTreeMenuCode.listOfValuesModel}">
      <f:validator binding="#{bindings.MsMenusTreeMenuCode.validator}"/>
      </af:inputListOfValues>

      and here is the code for onLovLoadParentMenu method:

      BindingContext bctx = BindingContext.getCurrent();
      BindingContainer bindings = bctx.getCurrentBindingsEntry();
      FacesCtrlLOVBinding lov = (FacesCtrlLOVBinding)bindings.get("MsMenusTreeMenuCode");
      lov.getListIterBinding().getViewObject().setNamedWhereClauseParam("p_code", "200");

      putting the following code after the above code shows that at this time everything is OK and p_code = 200 is applied to the query and the result is what I was expecting:

      RowSetIterator rs = lov.getListIterBinding().getViewObject().createRowSetIterator(null);
      rs.reset();
      int counter = 0;

      while (rs.hasNext()) {
      Row r = rs.next();
      System.out.println(++counter + ": " + r.toString());
      }

      but when the LOV dialog opens and I click the search button to populate the list it contains wrong records and I found that the result set is for p_code = null . Why is this happening? What should I do?

      Anyway, I am using JDev 11.1.1.4

      Regards,
      Ferez