1 Reply Latest reply on Aug 23, 2017 6:40 AM by Juraj Lonc

    Tree: DragAndDrop support lost after node is expanded

    Juraj Lonc Newbie

      I'm facing a problem with rich:tree.

      Nodes in this tree are expandable, that works OK. I can expand and collapse them, toggleType is "ajax".

      And there is drag-and-drop support on these nodes. I can drag any node and drop on another node. That works OK as well.

      But problem is when I collapse or expand some node. After this none of descending node is draggable.

      It seems that "RichFaces.ui.Draggable" and "RichFaces.ui.Droppable" is not executed after expand/collapse.

       

      This is my code:

                  <rich:tree id="tree" onbeforeselectionchange="ajaxLoadingStart();" onselectionchange="ajaxLoadingComplete();" selectionChangeListener="#{structureBean.selectionChanged}" nodeType="#{node.type}" var="node" value="#{structureBean.rootNodes}" toggleType="ajax" selectionType="ajax" >
                                       <rich:treeNode type="department" iconLeaf="#{node.icon}" iconExpanded="#{node.icon}" iconCollapsed="#{node.icon}" expanded="#{node.expanded}" onbeforetoggle="ajaxLoadingStart();" ontoggle="ajaxLoadingComplete();">
                               <a4j:outputPanel>
                                    <rich:dragIndicator id="indicator" acceptClass="accept" rejectClass="reject" draggingClass="default"><h:outputText value="#{node.data.universalTitle}" /></rich:dragIndicator>
                                    <rich:dropTarget onbeforedomupdate="ajaxLoadingComplete();" onbegin="ajaxLoadingStart();" oncomplete="ajaxLoadingComplete();" acceptedTypes="department, position" dropValue="#{node}" render="tree" dropListener="#{structureBean.processDrop}" />
                                    <rich:dragSource type="#{node.type}" dragValue="#{node}" dragIndicator="indicator" />
      <table border="0" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 5px;">
                                         <h:outputText value="#{node.data.universalTitle}" />
      </td><td>
                                    <h:outputLink value="../departments/department.xhtml?id=#{node.data.id}">
      <qi:icon standardIcon="link-small" />
                                    </h:outputLink>
      </td></tr></table>
                               </a4j:outputPanel>
                          </rich:treeNode>
                          <rich:treeNode type="position" icon="#{node.icon}" iconLeaf="#{node.icon}">
                               <a4j:outputPanel>
                                    <rich:dragIndicator id="indicator2" acceptClass="accept" rejectClass="reject" draggingClass="default"><h:outputText value="#{node.data.universalTitle}" /></rich:dragIndicator>
                                    <rich:dropTarget acceptedTypes="department, position" dropValue="#{node}" render="tree" dropListener="#{structureBean.processDrop}" />
                                    <rich:dragSource type="#{node.type}" dragValue="#{node}" dragIndicator="indicator2" />
                                    <h:outputLink value="../positions/position.xhtml?id=#{node.data.id}">
                                         <h:outputText value="#{node.data.universalTitle}" />
                                    </h:outputLink>
                               </a4j:outputPanel>
                          </rich:treeNode>
                  </rich:tree>
      

       

      Do I have some error in my code? Or it is some bug in Richfaces?