1. #1
    Sencha User enotsl's Avatar
    Join Date
    Jul 2007
    Posts
    42
    Vote Rating
    0
    enotsl is on a distinguished road

      0  

    Default Why the treenode appendChild no work?

    Why the treenode appendChild no work?


    The "oldParent.appendChild(node);" is not work,

    but "oldParent.appendChild({nodeType:'async', text:name, cls:'x-nav-file', icon:icon, id:id, _id:_id, leaf:true})" can append a childnode, but have error

    Code:
    a is undefined
    DomHelper()(Object browserEvent=Event resize button=-1 type=resize, undefined)ext-all.js 
    
    DomHelper()(Object browserEvent=Event resize button=-1 type=resize, div#extdd-43.x-tree-node-el)ext-all.js 
    
    C()
    i had search the old post about this problem, but the resolvent is not work.

    why, pls help me. thanks, my code is at below.

    Code:
        onBeforeMoveNode : function(tree, node, oldParent, newParent, index ){
            var opath = node.id;
            var npath = (newParent.id + '\/' + node.text).formatPath();
            if(opath==npath) return false;    
            Ext.Ajax.request({
                url: cfg.ajaxPath+'moveFile',
                params: { opath: opath, npath: npath },
                success: function(response,opt) {
                    if(!response.responseText){
                        node.id = npath;
                    }else{
                        Ext.Msg.alert('error', 'Have the same file name');
                        oldParent.appendChild(node);
                        newParent.removeChild(node);
                    }
                }            
            });            
        },

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Calling appendChild automatically calls removeChild on the old parent, so you get an error if you try to do it a second time.

    ps. An error from ext-all.js is totally useless. Use ext-all-debug.js for testing!

Thread Participants: 1