Javascript jstree 3.0.0上下文菜单右键单击不工作。显示TypeError:vakata_context.element.html不是函数
我的代码正在渲染树、父级、子级所有内容,但右键单击上下文菜单不显示。Firebug显示错误“TypeError:vakata_context.element.html不是函数”。如果我删除contextmenu插件,它会显示默认的浏览器右键单击选项。这是代码Javascript jstree 3.0.0上下文菜单右键单击不工作。显示TypeError:vakata_context.element.html不是函数,javascript,contextmenu,jstree,Javascript,Contextmenu,Jstree,我的代码正在渲染树、父级、子级所有内容,但右键单击上下文菜单不显示。Firebug显示错误“TypeError:vakata_context.element.html不是函数”。如果我删除contextmenu插件,它会显示默认的浏览器右键单击选项。这是代码 jsjQuery(document).ready(function () { $('#pages-wrapper').jstree({ 'core' : { callback:{
jsjQuery(document).ready(function () {
$('#pages-wrapper').jstree({
'core' : {
callback:{
onchange:function(node,tree){
document.location='pages.php?action=edit&id='
+node.id.replace(/.*_/,'');
},
onmove:function(node){
var p=$.tree.focused().parent(node);
var new_order=[],nodes=node.parentNode.childNodes;
for(var i=0;i<nodes.length;++i)
new_order.push(nodes[i].id.replace(/.*_/,''));
$.getJSON('/ww.admin/pages/move_page.php?id='
+node.id.replace(/.*_/,'')+'&parent_id='
+(p==-1?0:p[0].id.replace(/.*_/,''))
+'&order='+new_order);
}
}
},
"plugins" : ["contextmenu"],
'contextmenu':{
'items':{
'create' : {
'label' : "Create Page",
'icon' : "create",
'visible' : function (NODE, TREE_OBJ) {
if(NODE.length != 1) return 0;
return TREE_OBJ.check("creatable", NODE);
},
'action':pages_add_subpage,
'separator_after' : true
},
'rename':false,
'remove':{
'label' : "Delete Page",
'icon' : "remove",
'visible' : function (NODE, TREE_OBJ) {
if(NODE.length != 1) return 0;
return TREE_OBJ.check("deletable", NODE);
},
'action':pages_delete,
'separator_after' : true
}
}
}
});
var div=$( '<div><i>right-click for options</i><br /><br /></div>');
$('<button>add main page</button>')
.click(pages_add_main_page)
.appendTo(div);
div.appendTo('#pages-wrapper');
});
function pages_add_main_page(){
pages_new(0);
}
function pages_new(p){
$('<form id="newpage_dialog" action="/ww.admin/pages.php" method="post"><input type="hidden" name="action" value="Insert Page Details" /><input type="hidden" name="special[1]" value="1" /><input type="hidden" name="parent" value="'+p+'" /><table><tr><th>Name</th><td><input name="name" /></td></tr><tr><th>Page Type</th><td><select name="type"><option value="0">normal</option></select></td></tr><tr><th>Associated Date</th><td><input name="associated_date" class="date-human" id="newpage_date" /></td></tr></table></form>')
.dialog({
modal:true,
buttons:{
'Create Page': function() {
$('#newpage_dialog').submit();
},
'Cancel': function() {
$(this).dialog('destroy');
$(this).remove();
}
}
});
$('#newpage_date').each(convert_date_to_human_readable);
return false;
}
function pages_add_subpage(node,tree){
var p=node[0].id.replace(/.*_/,'');
pages_new(p);
}
function pages_delete(node,tree){
if(!confirm(
"Are you sure you want to delete this page?"))return;
$.getJSON('/ww.admin/pages/delete.php?id='
+node[0].id.replace(/.*_/,''),function(){
document.location=document.location.toString();
});
}
jsjQuery(文档).ready(函数(){
$(“#页面包装器”).jstree({
“核心”:{
回拨:{
onchange:函数(节点、树){
document.location='pages.php?action=edit&id='1
+node.id.replace(/.*;
},
onmove:函数(节点){
var p=$.tree.focused().parent(节点);
var new_order=[],nodes=node.parentNode.childNodes;
对于(var i=0;i我在一周前遇到了相同的问题,添加以下css规则修复了我的问题:
.vakata-context {
z-index:999 !important;
}
我可以看到模态后面的上下文菜单。因此,我通过指定比模态更大的z索引来修复它。例如,我的模态具有z索引:10050
,我通过执行以下操作修复了该问题:
.vakata-context { z-index:10052 !important; }
也为我修正了。为我修正了。我从没想到这和css问题有关,但也为我修正了:)