Jstree如何明智地配置contextmenu类型以及添加或删除节点时如何将其存储在数据库中

时间:2011-06-02 14:20:20

标签: types contextmenu jstree

正在使用

$("#demo1").jstree({ 
        "xml_data" : {
            "ajax" : {
                "url" : "phpxml.php",
                "data" : function (n) { 
                    return { 
                    "operation" : "get_children",
                    "id" : n.attr ? n.attr("id").replace("node_","") :1
}; 
                }
            }
        },
"plugins" : [ "themes", "xml_data" ,"ui","crrm","contextmenu","types"],
        "contextmenu" : 
        {
            items: 
            {
                "ccp" : false,
                "create" : 
                {
                                    "label" : "Create",

                    "action" : function (obj) { this.create(obj); },
                    "_disabled"  : function (obj) { alert("obj=" + obj); return "default" != obj.attr('rel'); }
                },
    }
        },
});
});

1 个答案:

答案 0 :(得分:1)

您必须使用:“contextmenu”:{items:customMenu},
customMenu是一个函数。 您可以看到相同的问题:Configuring jstree right-click contextmenu for different node types