0 Replies Latest reply on May 8, 2008 3:11 AM by leelavathic leelavathic

    How to rerender a tree node in rich faces

    leelavathic leelavathic Novice

      Hi
      I would like to re-render a node in a richfaces tree rather than rendering the whole tree, through my backing bean.

      I tried to do it as mentioned below.

      AjaxContext ajaxCtx = AjaxContext.getCurrentInstance();
      ajaxCtx.addComponentToAjaxRender(selTreeNode);
      // selTreeNode is the UITreeNode component of selected tree node, which
      // I want to render

      But while rendering the tree I got the following exception in the browser.

      ************************************************************
      java.lang.IllegalStateException: No tree element available or row key not set!
      org.richfaces.model.TreeDataModel.isLeaf(TreeDataModel.java:290)
      org.richfaces.component.UITree.isLeaf(UITree.java:492)
      org.richfaces.renderkit.html.TreeNodeRenderer.doEncodeBegin(TreeNodeRenderer.java:161)
      org.richfaces.renderkit.html.TreeNodeRenderer.doEncodeBegin(TreeNodeRenderer.java:106)
      org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:101)
      javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:801)
      org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:280)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:125)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
      org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:372)
      org.ajax4jsf.component.UIDataAdaptor.encodeAjaxChild(UIDataAdaptor.java:460)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:105)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
      org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123)
      org.ajax4jsf.component.UIAjaxRegion.encodeAjax(UIAjaxRegion.java:267)
      org.ajax4jsf.component.AjaxViewRoot$4.invokeContextCallback(AjaxViewRoot.java:484)
      javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:722)
      javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:663)
      javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
      javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:663)
      javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
      javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:663)
      javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
      javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:663)
      javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
      javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:663)
      javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
      javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:663)
      javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
      javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:663)
      org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:509)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
      com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
      org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
      com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
      org.ajax4jsf.Filter.doFilter(Filter.java:175)
      com.real.mms.devicemanager.ctl.filter.SessionTimeOutFilter.doFilter(SessionTimeOutFilter.java:77)
      ************************************************************

      Can any one let me know what went wrong or any suggestion to do it other way .

      Thanks in advance