2 Replies Latest reply: Jul 6, 2013 9:07 AM by sazz619 RSS

    get UIComponent from DCIteratorBinding

    25b27365-3e36-494a-ae11-f64588be3206

      Hello,

      Is It possible to get UIComponent from DCIteratorBinding ?

       

      I have two forms and I want to move the focus from one to the other. So I need to get the widget to position the focus.

       

      Thanks.

        • 1. Re: get UIComponent from DCIteratorBinding
          Frank Nimphius-Oracle

          Hi,

           

          no. An iterator can serve multiple UI components at the same time and there is no reverse relation that allows you to tell which components are bound to it. Why does this use case need to be implemented on the binding layer and not on the UI?

           

          Frank

          • 2. Re: get UIComponent from DCIteratorBinding
            sazz619

            You can create a command button , set auto Submit=true ,clientComponent=true .

            <af:commandButton text="Change Focus" id="cb" actionListner="beanMethod"> 
              <af:clientListener type="click" method="setFocusId"/> 
            </af:commandButton>

             

            void beanMethod(Actionevent event){

             

             

             

            FacesContext context = FacesContext.getCurrentInstance();

                    UIComponent ip=context.getViewRoot().findComponent("<id>");

            String clientId = ip.getClientId(Context);

                 

            ExtendedRenderKitService service =

                   Service.getRenderKitService(Context,

                                                    ExtendedRenderKitService.class);

            String script =

                   "setFocusId('" + clientId + "')";

                    service.addScript(Context, script);

             

            }

             

            add a javascript on the page :

             

             

             

            function setFocusId(id) {

                    var t=document.getElementById(id);

                    t.focus();

                  }

             

            I have not implemented this ,so please do necessary changes needed

            Hope this helps !!