9 Replies Latest reply on Mar 11, 2010 1:08 PM by Nick Belaevski

    RICH:tree AbstractTreeDataModel rowIndex must be -1.

    praveen jain Novice

      hi

      i am just trying to create a simple application with rich:tree but gettign exception

      javax.servlet.ServletException: In AbstractTreeDataModel rowIndex must be -1.
           javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
           org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
           org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
           org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      

       

      root cause

      java.lang.IllegalArgumentException: In AbstractTreeDataModel rowIndex must be -1.
           org.richfaces.model.AbstractTreeDataModel.setRowIndex(AbstractTreeDataModel.java:52)
           org.ajax4jsf.component.UIDataAdaptor.setRowIndex(UIDataAdaptor.java:289)
           javax.faces.component.UIData.visitColumnsAndRows(UIData.java:1544)
           javax.faces.component.UIData.visitTree(UIData.java:1212)
           javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
           javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
           javax.faces.component.UIForm.visitTree(UIForm.java:333)
           javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
           javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:869)
           org.ajax4jsf.application.AjaxStateManager.restoreView(AjaxStateManager.java:439)
           com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
           com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
           org.ajax4jsf.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:107)
           com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
           com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
           com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
           com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
           org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
           org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
           org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      

      the code is

       

        

      private

      TreeNode treeNode;

       

       

       

      public TreeNode getTreeNode() {

       

      if(treeNode==null){

       

      treeNode=new TreeNodeImpl();

      TreeNode nd=

      new TreeNodeImpl();

      nd.setData(

      "MY NAME");

       

      treeNode.addChild("NAME", nd);

      }

       

      return treeNode;

      }

      public

       

      void applyForDin() {

      System.

      out.println("BINDED TO DIN");

      setNameApproval(

      false);

      setDin(

      true);

       

      // set

       

      //return "din";

       

      }

       

      jsf is

       

      <

      h:panelGrid columns="2">

       

      <rich:tree style="width:300px" rendered="true" value="#{common.treeNode}" ajaxKeys="#{null}" switchType="client">

       

      <rich:treeNode ajaxSubmitSelection="false">

       

      <h:outputLabel value="DIN">

       

      <a4j:support event="onclick"

       

      action="#{common.auth.role.applyForDin}" reRender="dinpanel"></a4j:support>

       

      </h:outputLabel>

       

      </rich:treeNode>

       

      <rich:treeNode>

       

      <h:outputText value="Name Approval">

       

      </h:outputText

      >

       

       

      </rich:treeNode>

       

       

      </rich:tree>

       

      <t:panelGrid rendered="#{common.auth.role.din}" id="dinpanel">

       

       

      <t:outputLabel value="PAHGE HERE "></t:outputLabel>

       

       

      </t:panelGrid>

      the exception occurs when i click on the node.