[CLOSED] Some Issue with TreePanel Drag and Drop

  1. #1

    [CLOSED] Some Issue with TreePanel Drag and Drop

    Hi,
    I have some issues with Tree Drag and Drop. I did not have them with v1.3. May be I am missing something here.

    1) I have node.Leaf=true. And have set Allow LeafDrop=true. Despite this I am not able to drop a node on it.

    2) If I have node.Leaf=false, I always see a plus sign on the left of Node even if there are no children. I have to explicitely set a expandable=false to remove the plus sign. And if I set expandable=false, even if I drop a node, it wont show the plus sign.

    2) If I try to expand a node (After Drop, or if it has children), it throws an error, as its expecting some event on server. In earlier versions, it would never fire a server event until explicitly mentioned. Now it always shows a loading icon (1st time when a node is expanded). Notice this in the example here : https://examples1.ext.net/#/TreePane...Reorder_Nodes/

    Expand any node, or Drop ay node on another. It will show a Loader 1st. I dont want that behaviour. I want to handle all events myself. How do I disable these default events?

    Here's my code:

    ASPX
    <ext:ResourceManager runat="server"></ext:ResourceManager>
            <ext:TreePanel ID="sectionsTree" runat="server" RootVisible="false" Width="700"  Height="800" AllowLeafDrop="true">
                <View>
                        <ext:TreeView ID="TreeView1" runat="server" MultiSelect="true" >
                           <Plugins>
                                <ext:TreeViewDragDrop ID="TreeViewDragDrop1" runat="server"  />
                            </Plugins>
                        </ext:TreeView>
                </View>
            </ext:TreePanel>
    c#
    public partial class mapsections : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest) {
                    LoadTree(sectionsTree.Root);    
                }  
            }
    
    
            public Ext.Net.NodeCollection LoadTree(Ext.Net.NodeCollection nodes)
            {
                if (nodes == null)
                {
                    nodes = new Ext.Net.NodeCollection();
                }
    
    
                xmlStoreDbEntities db = new xmlStoreDbEntities();
                Ext.Net.Node root = new Ext.Net.Node();
                root.NodeID = "root";
                root.Text = "No Sections Available";
                root.Icon = Ext.Net.Icon.Blank;
                nodes.Add(root);
                
                for (int i = 0; i<100 ;i++)
                {
                    Node n = new Node();
                    n.Text = "Node - " + i.ToString();
                    n.NodeID = i.ToString();
                    n.Leaf = true;
                    n.AllowDrop = true;
                    n.AllowDrag = true;
                    root.Children.Add(n);
                    //if (n.Children.Count == 0)
                    //{
                    //    n.Expandable = false;
                    //}
    
    
                }
    
    
                return nodes;
    
    
            }
    
    
        }
    Last edited by Daniil; May 23, 2012 at 8:40 PM. Reason: [CLOSED]
  2. #2
    I have node.Leaf=true. And have set Allow LeafDrop=true. Despite this I am not able to drop a node on it.
    AllowLeafDrop must be set for TreeViewDragDrop

    If I have node.Leaf=false, I always see a plus sign on the left of Node even if there are no children. I have to explicitely set a expandable=false to remove the plus sign. And if I set expandable=false, even if I drop a node, it wont show the plus sign.
    All nodes is async in v2. Therefore if node is not leaf and children is not defined then the node will request nodes from a server
    You can set EmptyChildren for the node to render empty children array (it will remove plus sign and prevent request to tyhe server)

    If I try to expand a node (After Drop, or if it has children), it throws an error, as its expecting some event on server. In earlier versions, it would never fire a server event until explicitly mentioned. Now it always shows a loading icon (1st time when a node is expanded). Notice this in the example here : https://examples1.ext.net/#/TreePanel...Reorder_Nodes/
    EmptyChildren will help you
  3. #3
    Hi Vlad,
    It works now. Thanks!

    Don't you think this behaviour should be by default? Like EmptyChildren should be automatically true if there is no children and emptychildren should automatically change to false when a node is added?
  4. #4
    One more minor issue.
    MultiSelect on TreeView does'nt work. I have add a SelectionModel to enable multi select.
  5. #5
    MultiSelect on TreeView does'nt work. I have add a SelectionModel to enable multi select.
    MultiSelect of TreeView is initialized by MultiSelect of TreePanel. So, you have to set MultiSelect for TreePanel

    Don't you think this behaviour should be by default? Like EmptyChildren should be automatically true if there is no children and emptychildren should automatically change to false when a node is added?
    I don't think so. In mostly cases, empty non leaf node means that children will be loaded from the server after expand

Similar Threads

  1. Drag Drop events in TreePanel
    By web4u in forum 2.x Help
    Replies: 0
    Last Post: Aug 08, 2012, 6:31 AM
  2. TreePanel - Drag & Drop
    By jigpatel06 in forum 1.x Help
    Replies: 0
    Last Post: Oct 19, 2010, 10:31 AM
  3. [CLOSED] [1.0] - MVC - TreePanel Drag-Drop DirectEvents
    By drkoh in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 22, 2010, 3:11 PM
  4. [CLOSED] TreePanel Drag and Drop
    By davidhoyt in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 28, 2009, 5:24 AM

Tags for this Thread

Posting Permissions