2011-06-07 54 views
0

這是我的代碼,它應該在使用ctrl鍵時防止節點複製,但它仍然允許複製並且不會阻止它。jsTree copy_modifier:false - 不會阻止節點複製!

根據文檔我使用"copy_modifier" : false - 任何想法爲什麼它不起作用?

我使用穩定版本"jsTree 1.0-rc3"只是幾天前通過網站上的大下載按鈕下載。

$(function() { 

    $("#jsTree") 
     .jstree({ 
      "plugins" : ["themes","html_data","ui","crrm","hotkeys","types","dnd","contextmenu"], contextmenu: {items: customMenu} 
      //"core" : { "initially_open" : [ "node_root" ] } 
     ,"types" : { 
      "valid_children" : [ "group","unknowngroup" ], 
      "types" : { 
       "group" : { 
        "valid_children" : ["event"], 
        "start_drag" : false, 
        "move_node" : false, 
        "delete_node" : false, 
        "remove" : false, 
        "icon" : { 
         "image" : "layout/img/folder.png" 
        }, 
       }, 
       "unknowngroup" : { 
        "valid_children" : ["event"], 
        "start_drag" : false, 
        "move_node" : false, 
        "delete_node" : false, 
        "remove" : false, 
        "icon" : { 
         "image" : "http://www.veryicon.com/icon/16/System/Pleasant/Recycle%20Bin%20e.png" 
        }, 
       }, 
       "event" : { 
        "valid_children" : "none", 
        "icon" : { 
         "image" : "http://ouccc.objectis.net/events/aggregator/previous/event_icon.gif" 
        }, 
        "start_drag" : true, 
        "move_node" : true, 
        "delete_node" : false, 
        "remove" : false 
       } 
      }, 
      "dnd" : { 
       "copy_modifier" : false, 
       "drag_check" : function (data) { 
        return { 
         after : true , 
         before : true , 
         inside : true 
        }; 
       } 
      } 
     } 
     }).bind("rename.jstree", function (e, data) { 
      if(prefix!="") 
      { 
       commitGroupRename(data.rslt.obj.attr("id").substring(11),data.rslt.new_name); 
       var text= prefix + data.rslt.new_name; 
       $("#jsTree").jstree('rename_node', data.rslt.obj, text); 
       prefix=""; 
      } 
     }).bind("loaded.jstree", function (event, data) { 
       //$("#jsTree").jstree("open_all"); 
     }).bind("dblclick.jstree", function (event) { 
      var node = $(event.target).closest("li"); 
      //var data = node.data("jstree"); 
      if ($(node).attr('rel')=="group" && prefix =='') 
      { 
       var text = $("#jsTree").jstree('get_text',node); 
       prefix = text.substring(0,5); 
       text = text.substring(5); 
       $("#jsTree").jstree("rename_node", node , text); 
       $("#jsTree").jstree("rename",node); 
      } 
     }).bind("select_node.jstree", function (node, ref_node) { 
      var theRealNode = $.jstree._focused().get_selected(); 
      if (theRealNode.attr('rel')=="group") 
      { 
       $('#btnRenameSelected').attr("disabled", false); 
       $('#btnRenameSelected').removeClass("ui-state-disabled"); 
      } 
      else 
      { 
       $('#btnRenameSelected').attr("disabled", true); 
       $('#btnRenameSelected').addClass("ui-state-disabled"); 
      } 
      }); 
}); 

回答

0

固定 - 正如你可以看到「dnd」實際上在「types」範圍內。衛生署! - 如果允許,將接受。

+0

需要理清該死的縮進^^ – Chris 2011-06-07 15:38:01