0
저는 crst와 json_data 플러그인에 jstree를 사용하고 있습니다. 노드에서 이름 바꾸기 함수를 호출하려고하면 오류가 발생합니다. 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
늦게 답변을 드려 죄송합니다. 코드에서 "rename_node"를 "rename_node"로 대체 해 보셨습니까? 그래서, $ ('selector') 대신에 .jstree ('rename', ...), $ ('selector')를 시도해보십시오. jstree ('rename_node', ...); –