2 Replies Latest reply on Feb 27, 2008 7:00 PM by Fab Mars

    rich:tree drag and drop question

    Henry Mok Newbie

      I'm having a problem refreshing a tree after a drag and drop operation. What I'm trying to accomplish with the drag and drop is to switch two branches. for example if this is the tree

      branch A
      branch B

      if I drag branch A to branch B, I want the tree to look like this

      branch B
      branch A

      but it ends up looking like this

      branch A
      branch A

      The bean is changing the tree correctly. If I refresh the browser or expand the tree branch, it will change to the correct order. It looks like the drop listener is only rerendering the area being dropped into, not the whole tree or the area being dragged from. How does the drop listener work as far as rerendering and is there any way to change this bahavior?

      Here is my code for the tree. Any help would be appreciated.

      <rich:tree id="treeId" dragIndicator=":indicator" dropListener="#{CategoryGroupTreeBean.processDrop}"
      style="width:300px" value="#{CategoryGroupTreeBean.treeNode}" var="item" nodeFace="#{item.type}" reRender="treeId">

      <rich:treeNode id="tabNode" type="tabTreeNode" dragType="tabTreeNode" acceptedTypes="tabTreeNode"
      dragValue="#{item}" dropValue="#{item}" >
      <h:outputText value="#{item.title}" />
      <rich:dndParam name="label" type="drag" value="Tab: #{item.title}" />
      </rich:treeNode>

      <rich:treeNode id="prodNode" type="prodTreeNode" dragType="prodTreeNode" acceptedTypes="prodTreeNode"
      dragValue="#{item}" dropValue="#{item}" >
      <h:outputText value="#{item.prodId}" />
      <rich:dndParam name="label" type="drag" value="Product: #{item.prodId}" />
      </rich:treeNode>

      </rich:tree>