OdinaSpb / jstree

Automatically exported from code.google.com/p/jstree
0 stars 0 forks source link

old node remains after moving #987

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What is the expected output? What do you see instead?
I use move_node to move a node to a new position but the old node remain (just 
like copying)

What version of the product are you using? On what browser?
jsTree 1.0-rc3
IE 8

Please provide any additional information below.

data file: 1.json
[
    { 
    "data" : "Node 1", 
    "attr" : {"id":"n1", "note":"this is node 1" },
    "children" : [  {"data": "A", "attr": {"id":"n1_1"}}, 
            {"data": "B", "attr": {"id":"n1_2"}}, 
            {"data": "C", "attr": {"id":"n1_3"}}, 
            "D"
             ], 
    "state" : "open" 
    },
    { 
    "data" : "Node 2", 
    "attr" : {"id":"n2", "note":"this is node 2" }
    }
]

$("#demo5").jstree({ 
  "json_data" : {
    "ajax" : {
    url : "1.json",
    contentType: 'application/json; charset=utf-8',
    success: function(data){
         return data.d;
      }
    }                
   },

   "crrm":{
                "move" : {  
                    "check_move" : function (m) { 
                        return (m.o[0].id === "n1") ? false : true;  
                    }                      
                }
            },

            "plugins" : [ "themes", "json_data", "ui", "crrm" ]
        });

$("#btn5_Move1").click(function(){
   $("#demo5").jstree("move_node", "#n2", "#n1", "first", -1);   
});

Original issue reported on code.google.com by supplie...@hotmail.com on 24 Nov 2011 at 10:32

GoogleCodeExporter commented 9 years ago
add this :
"crrm":{
        "move" : { 
            "always_copy": "false"
         }
}

or when u call move_node( node , ref , position , is_copy , is_prepared , 
skip_check ) set is_copy argument to false 

Original comment by hiba.mr...@gmail.com on 26 Mar 2012 at 7:16