1 Reply Latest reply: Mar 1, 2012 4:21 AM by 895887 RSS

    Accessing FacesCtrlLOVBinding to set Bind Variable in Tree Binding

    895887
      Hi. I have an af:table component containing several columns that have LOVs defined in the View Object. The LOV data sources contain bind variables that I need to set programmatically based on some other user-entered values.

      I've created LaunchPopupListener to perform this LOV bind variable setting, but I'm having difficulty getting to the LOV view objects in order to set the bind variable and execute the query. I've managed to get it to work as follows:
              BindingContext bctx = BindingContext.getCurrent(); 
              BindingContainer bindings = bctx.getCurrentBindingsEntry(); 
              DCBindingContainer myDCBindings = (DCBindingContainer)bindings;
              List myExecBindings = myDCBindings.getExecutableBindings();
              
              JUFormBinding myFormBinding = (JUFormBinding) myExecBindings.get(2);
              FacesCtrlLOVBinding lov = (FacesCtrlLOVBinding) myFormBinding.get("Value2");
              ViewObject listVO = lov.getListIterBinding().getViewObject();
      
              lov.getListIterBinding().getRowSetIterator().getRowSet().setNamedWhereClauseParam("bindApplicationView",toDoApplicationView);
              lov.getListIterBinding().getRowSetIterator().getRowSet().executeQuery();
      As you can see, I'm getting a Form binding (which appears to be created dynamically by ADF - presumably to hold the Lov Bindings?) based on its position rather than by name (which I don't know can be predicted?) and from there, the FacesCtrlLOVBinding. After that, all is well.

      There must be a better way to get to the LOV Binding in this example?! Can anyone help me with any suggestions please?

      Thanks.

      (using JDeveloper 11.1.2.1.0)
        • 1. Re: Accessing FacesCtrlLOVBinding to set Bind Variable in Tree Binding
          895887
          Ok, so I'm still pretty new to this technology...

          I've revised my approach from that posted above. Now I've created additional List-of-Values bindings on the Page Def from the same Iterator. Now I refresh the LOV View Objects from these bindings with a little more control...
                    BindingContext bctx = BindingContext.getCurrent(); 
                    BindingContainer bindings = bctx.getCurrentBindingsEntry(); 
            
                    FacesCtrlLOVBinding lov = (FacesCtrlLOVBinding)bindings.get("Value2");
                    ViewObject listVO = lov.getListIterBinding().getViewObject();
                              
                    lov.getListIterBinding().getRowSetIterator().getRowSet().setNamedWhereClauseParam("bindApplicationView",toDoApplicationView);
                    lov.getListIterBinding().getRowSetIterator().getRowSet().executeQuery();// .getViewObject().getRowSet().executeQuery();
          Does this now constitute better practice? Or is there still a better way to go about it? Thanks.

          Also, as my Lovs are displayed as Combo boxes, the user could type values into them before the Popup is launched - resulting in invalid value exceptions. Where could I perform the refresh prior to the popup launch event?