Jstree and rename-Collection of common programming errors
Rename node in my jstree script doesn’t work’s, and J don’t know why, here is my script:
$(function () {
$("#stworz_powiazanie").click(function () {
$("#pages-wrapper").jstree("create");
});
$("#usun_powiazanie").click(function () {
if(!confirm("Czy na pewno chcesz usunac te strone?"))return;
$("#pages-wrapper").jstree("remove");
});
$("#zmien_nazwe").click(function () {
$("#pages-wrapper").jstree("rename");
});
$("#cut").click(function () {
$("#pages-wrapper").jstree("cut");
});
$("#paste").click(function () {
$("#pages-wrapper").jstree("paste");
});
$("#pages-wrapper").jstree({
"core" : { "initially_open" : [ "root" ],
"load_open" :true,
"animation" :0,
},
"html_data" : {
"ajax" : {
"url" : "./pobierz.php",
"data" : function (n) {
return { id : n.attr ? n.attr("id") : 0 };
}
} },
"plugins" : ["themes","html_data","ui","contextmenu","crrm","types"],
(............)
$("#pages-wrapper").bind("rename.jstree", function (e, data) {
$.ajax({
type: "POST",
url: './server.php',
data: {
"operation" : "rename_node",
"id" : data.rslt.obj.attr("id").replace("node_",""),
"title" : data.rslt.new_name
},
success : function (r) {
if(!r.status) {
data.inst.refresh();
alert('Zmieniono Nazwe');
}
}
});
})
});
});
from firebug J have report:
TypeError: obj is undefined return obj.nodeValue;
What is wrong with my script ? Can anyone check this and tell me what is wrong ?