0
我使用jstree与crrm和json_data插件。当我尝试调用节点上的重命名函数时出现错误obj.trigger不是函数。jsTree重命名不起作用
我的代码:
//definiton of tree
$('selector').jstree({
//config for tree themes plugin
'themes' : {
'theme' : 'classic',
'dots' : true,
'icons' : true
},
//config for tree json_data plugin
json_data : {
ajax : {
url: '?',
type: 'POST',
dataType: 'json',
beforeSend: function(xhr, s){
xhr.setRequestHeader("Accept", "text/x-json");
},
context: this,
data: $.proxy(this,'_generateTreeJSONData'),
success: $.proxy(this,'_onTreeLoad'),
error: $.proxy(this,'_onTreeError')
}
},
//config for tree drag and drop plugin
dnd:{
drop_finish: $.proxy(this,'_onTreeDropFinish'),
drag_finish: $.proxy(this,'_onTreeDragFinish'),
drop_check: $.proxy(this,'_onTreeDropCheck'),
drag_check: $.proxy(this,'_onTreeDragCheck'),
drop_target: false,
drag_target: false
},
//config for tree creating renaming removing moving (crrm) plugin
crrm:{
move:{
check_move: $.proxy(this,'_onTreeMoveCheck')
}
},
plugins : ['themes','json_data','ui','dnd','crrm','contextmenu']
});
//conect to click of tree node
$(".ep-acb-tree a").live("click", $.proxy(this,'_onClickTreeNode'));
_onClickTreeNode: function(evt){
$('selector').jstree('rename',evt.currentTarget);
},
这仅仅是我的代码,但拖放和其他一切工作正常的一部分。
感谢您的帮助。 本
是的,我想这一点,但我的问题是,我无法打开编辑模式。 您的解决方案将绑定到重命名完成后触发的事件,我猜。 我虽然尝试了contextmenu插件,当我在菜单中单击重命名时,我得到相同的错误。 – Ben 2011-05-06 06:59:49
对不起,对于最近的回复,但你有没有尝试用代码中的“rename_node”代替“rename”?因此,而不是$('selector')。jstree('rename',...),试试$('selector')。jstree('rename_node',...); – 2011-05-10 04:09:09