webtier@glassfish.java.net

Custom Renderer Doesn't Render Children on AJAX Postback

From: <webtier_at_javadesktop.org>
Date: Thu, 20 May 2010 08:07:10 PDT

I've encountered a problem when creating my own custom renderer where I refresh a UIData component through a polling AJAX request and no children of the UIData component re-render. On the initial GET, the renderer displays the UIData table perfectly fine, but when the call to the jsf.ajax.request responds back, only the table renders and the UIColumns don't re-render.

Here's my example:

public class TestRenderer extends Renderer {

   @Override
   public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
      super.encodeBegin(context, component);
 
      TestObject obj = (TestObject) component.getAttributes().get("testObject");
   
      component.getChildren().clear();

      if (obj != null) {
         UIComponent objComp = obj.getObjectComponent();

         if (objComp != null) {
            component.getChildren().add(objComponent);
         }
      }
   }

   @Override
   public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
      super.encodeEnd(context, component);
   }
}

I'm calling this renderer through a proxy tag defined through a componentType.
Do I need to recursively encode the children of the base UIData component by overriding the encodeChildren method?
[Message sent by forum member 'dperriero']

http://forums.java.net/jive/thread.jspa?messageID=470720