5 Replies Latest reply on Apr 9, 2010 6:46 AM by Ilya Shaikovsky

    Get rich:dropSupport working inside rich:treeNode

    Dmytro Panchenko Newbie

      Hi,

       

      I have a rich:treeNode that contains two panels and need the users to be able to drop only to a specific panel inside the treeNode.

       

      For that, I added rich:dropSupport to one of the panels and removed all drop-related attributes from the rich:tree and rich:treeNode. But it doesn't recognize the panel as a valid drop target. When I create the same panel outside the treeNode, objects can be dropped into it. It looks like treeNode settings still override the ones in the panel's dropSupport. Do you have an idea how to overcome that?

       

      I am using Richfaces 3.2.2

       

      Any help will be appreciated

        • 1. Re: Get rich:dropSupport working inside rich:treeNode
          Nick Belaevski Master

          Hi Dmytro,

           

          Can you please post page code?

          • 2. Re: Get rich:dropSupport working inside rich:treeNode
            Dmytro Panchenko Newbie

            Nick,  Here is the code for the tree:

             

            <div>
              <rich:dragIndicator id="indicator1" />
              <rich:tree style="width:300px"
                  value="#{treeService.treeNode}" var="item" componentState="#{treeState.state}"
                  id="categoryTree" nodeFace="#{item.type}">


                <rich:treeNode type="Service" id="serviceNode">


                  <ui:remove><!-- This panel is supposed to accept drag-and-drop,

                                  but doesn't --></ui:remove>                
                  <rich:panel id="pnl-drp-#{item.service.id}"

                       style="height: 5px; background-color: black;" >
                    <rich:dropSupport id="serviceDrop" acceptedTypes="ser"

                        actionListener="#{treeService.dropListener}" />                  
                  </rich:panel>


                  <ui:remove><!-- This panel can be dragged, and it works --></ui:remove>                
                  <h:panelGrid columns="2" border="0" id="pnl-s-#{item.service.id}">
                    <h:outputText value="#{item.service.name}" />
                    <rich:dragSupport dragType="ser" dragIndicator="indicator1" >
                      <rich:dndParam name="label" type="drag" value="Move #{item.service.name} to..." />
                    </rich:dragSupport>
                  </h:panelGrid>


                </rich:treeNode>
              </rich:tree>


              <ui:remove><!-- This panel accepts drag-and-drop

                              (as it is outside the tree?) --></ui:remove>                
              <rich:panel id="pnl-drp-NONE" style="height: 25px; background-color: black;" >
                <rich:dropSupport id="aboDropOutside" acceptedTypes="ser"

                    actionListener="#{treeService.dropListener}" />                  
              </rich:panel>
            </div>

            • 4. Re: Get rich:dropSupport working inside rich:treeNode
              Dmytro Panchenko Newbie

              Thank you Ilya,

               

              And, I found a workaround for this problem:

               

              <rich:treeNode  type="Service" id="serviceNode">

                  <rich:panel  id="pnl-drp-#{item.service.id}"

                         style="height: 5px; background-color:  black;" >

               

                       <rich:dragSupport dragType="ser" dragIndicator="indicator1"

                            ondragenter=" this.stopPropagation(); ">
                         <rich:dndParam name="label" type="drag" value="Move  #{item.service.name} to..." />
                      </rich:dragSupport>

                  </rich:panel>

              ...