jsTree copy_modifier:false - 不阻止节点复制!

时间:2011-06-07 15:18:51

标签: javascript jquery jstree

这是我的代码,它应该在使用ctrl键时阻止节点复制,但它仍然允许复制并且不会阻止它。

我根据文档使用"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");
            }
           });
});

1 个答案:

答案 0 :(得分:0)

已修复 - 正如您所见,“dnd”实际上位于“类型”范围内。卫生署! - 如果允许,将接受。