Results 1 to 3 of 3

Thread: Drag-drop to TreePanel

  1. #1

    Exclamation Drag-drop to TreePanel

    Hi all. I have TreePanel which populated with JSON from server. It has only 2 levels (parents and one level of children). I need ability to drag-drop children to the parents (aka rearrange children between parents). I set TreePanel like this (with ddAppendOnly=true):
    Code:
            this._tree_ugroup = new Ext.tree.TreePanel({
                layout:"fit",
                region:'north',
                title: "All User Groups",
                height:250,
                split:true,
                fitToFrame:true,
                autoScroll:true,
                id:'uman_tree_ugroup',
    
                enableDD: true,
                containerScroll: true,
                ddAppendOnly: true,
    
                // tree-specific configs:
                rootVisible: false,
                lines: false,
                useArrows: true,
    
                loader: new Ext.tree.TreeLoader({
                    dataUrl:'DataUManage.dat?m_type=ugroups',
                    listeners : {
                        'loadexception': OnRequestException,
                        "beforeload" : function(obj, node) {UMANAGE.StartLoadTrees(node)},
                        "load" : function(obj, node) {UMANAGE.StopLoadTrees(node)}
                    }
                }),
                listeners : {
                    'click': function(node) {UMANAGE.OnTreeNodeClick(node)},
                    'contextmenu': function(node,e) {UMANAGE.OnContextMenu(node,e)},
                    'nodedragover': function(e) {return UMANAGE.OnDragOver(e)}
                },
    
                root: new Ext.tree.AsyncTreeNode({id:"root"})
            });
    Now to the problem: some parent nodes can be empty. On server side I mark them as leaf:true (so in UI they will be shown as childless). Problem is drag-drop dont even call 'nodedragover' event for those nodes but I still need ability to drop children to parents that have 0 children yet.
    I also tried to remove "leaf:true" for those nodes and go with "children:[]" (trying specify that there are no children) but TreePanel's UI still shows that node with expandable arrow.

    How do I make sure that TreePanel shows childless node without expanding arrow but still allows to drop on it in?

    Thanks.

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    i would suggest doing leaf:false and children : [] and expanded : true :

    [docs]
    expanded : Boolean
    true to start the node expanded

  3. #3

    Default

    Thank you! Thank you! That was it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •