4 Replies Latest reply on Nov 18, 2008 9:55 AM by dreuzel

    AJAX  rerender from within a uicomponent

      As ajax:support can update part of the html screen
      I would like to create the triger from within a decode method in a UICompnent

      I already picked up the identifiers an can eventualy get to the different
      components pointed to by the identifiers.
      But I can not find the code Call to start the actual rerender


      Can nanyone help me

        • 1. Re: AJAX  rerender from within a uicomponent
          ilya_shaikovsky

          reRender attribute could be EL binded to some bean property and filled on the server according to your logic.

          • 2. Re: AJAX  rerender from within a uicomponent

            the problem is not the EL logic.

            it is the Decode method in the UIComponent that decides when and where the ajax expand is made.
            so I need to call it from within the UIComponent

            • 3. Re: AJAX  rerender from within a uicomponent
              ilya_shaikovsky

              So you should use ajax context like this:

               AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
              
               Set<String> renderedAreas = ajaxContext.getAjaxRenderedAreas();
              
               renderedAreas.add(SOMEUICOMPONENT.getClientId(context));
              


              • 4. Re: AJAX  rerender from within a uicomponent

                I gave it a shot but it does not seem to work
                maybe I'm doing it badly

                key contains comma separated id's the different components are found.

                public void render(FacesContext ctx,String key)
                { if (key==null) return;
                
                 AjaxContext ajaxContext = AjaxContext.getCurrentInstance(ctx);
                
                 Set<String> renderedAreas = ajaxContext.getAjaxRenderedAreas();
                 if (key instanceof String)
                 { String[] ids= ((String) key).split(",");//all the id's handle an encapsulation
                 UIComponent par=this;//find the topmost parrent
                 UIComponent ob;
                 while ((ob=par.getParent())!=null) {par=ob;}//get the root parent
                 for (int i=0;i< ids.length;i++) //for all id components
                 { UIComponent comp=par.findComponent(ids);//find the components
                 if (comp ==null) log.info("[ ajax upd component "+ids+" not found ");
                 else renderedAreas.add(comp.getClientId(ctx));
                 }
                
                 }
                
                
                
                }


                Just to be on the save side for rendering I added a button using the same (ids) appending to my UIComponent


                there is no automatic updat when the decode routine activates the above routine
                ther is automatic update when I ajaxCommand the above



                I'm I getting your suggestion wrong ?