5 Replies Latest reply on Oct 28, 2010 9:52 AM by harpritt

    Change sequence of leaf nodes or drop leaf in between

    jsfgeeks

      Hi all,

       

            I have a page with two trees. I am using two trees for drag N drop. From left tree I can drag the leaf and drop it on the right tree. But, suppose on the right tree I have one node with say 5 leaf nodes and I want to drop that dragged one at the 3rd position, then it is possible or not ? Or there is any other way to change the sequence of the leaf nodes. (I know that, new node will be inserted at last).

       

      Thanks in advance,

      JSF GEEKS

        • 1. Re: Change sequence of leaf nodes or drop leaf in between
          ilya_shaikovsky

          I think it should be not much hard to just reconstruct the tree model taking into consideration dragValue and dropValue. E.g. that values is keys of the nodes. So you just need to re-build the model starting from their parent adding dropped node before dragged one. So the positions should be changed.

          • 2. Re: Change sequence of leaf nodes or drop leaf in between
            jsfgeeks

            Thanks Ilya for your time & support.

             

                  But, I can't do that, because, if a user drops leaf node on other leaf node, the the destination node(leaf) should become the parent node of the source node. So, I think it doesn't work for me. If, there is any other solution, like I can drop leaf between two leafs, then it will be great. (Or any other solution, regarding my problem, will be great).

             

            Thanks again,

            JSF GEEKS

            • 3. Re: Change sequence of leaf nodes or drop leaf in between
              ilya_shaikovsky

              ic... actually you can't drop between nodes out-of-the-box. And there is no object in model for that to fill drop value even if possible..

               

              The thing I think worth to try is to create Node markup with two drop zones like

              <node>
              <outputpanel id="upperPanel" layout="block">
              ...
              <outputPanel id="contentPanel" layout="block">
              ...
              <node>
              

               

              Turn off defaul drop handling at node

              add drop supports to those panels

              customize indicators to became different for that zones

              the first panel should have drop support inside which will place dropped leaf before that node in listener

              the second - content panel which hadle the drop by making the dropped node the child leaf.

              • 4. Re: Change sequence of leaf nodes or drop leaf in between
                harpritt

                Hi ya gents

                 

                How did this go for you Jsf geeks, this is exactly what im working on at the moment.

                 

                Single tree though.

                 

                 

                • 5. Re: Change sequence of leaf nodes or drop leaf in between
                  harpritt

                  Hi Ilya

                   

                  I was just wondering if you had any more tips on dragging and dropping between nodes since your last post