jsTreeのドラッグアンドドロップの制御

jsTree ドラッグアンドドロッププラグイン は、
単に、dnd だけを書くと、

$('#tree').jstree({ 'core':{},
          "plugins":[  "dnd" ]
));

なんでもかんでも、どこの移動先にもドラッグアンドドロップで移動ができてしまう。
ファイルの下に、ぶら下げるような規則に反することをしない制御をする方法、、
→ check_callback : function を書けば良い。
以下、ノードのアイコンを判定し、ルートへの移動を可能にする制御を、"data" : {} の次に書く!

"check_callback" : function(operation, node, node_parent, node_position, more){
   if (operation=="move_node"){
      if (node_parent.icon != "jstree-folder" && node_parent.id != "#") return false;
   }
}

移動後のイベントを受け取って処理をするには、

$('#treediv').jstree({ 'core':{
  :
}}).on('move_node.jstree', function(e, data){
      console.log("id = " + data.node.id + "  text = " + data.node.text );
      console.log("移動前 parent id = " + data.old_parent + "  position = " + data.old_position );
      console.log("移動後 parent id = " + data.parent + "  position = " + data.position );

先頭ルートになるノードの親(parent) の id は、必ず "#" である。