{"id":2853,"date":"2014-02-26T21:49:44","date_gmt":"2014-02-26T21:49:44","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/02\/26\/jstree-and-rename-collection-of-common-programming-errors\/"},"modified":"2014-02-26T21:49:44","modified_gmt":"2014-02-26T21:49:44","slug":"jstree-and-rename-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/02\/26\/jstree-and-rename-collection-of-common-programming-errors\/","title":{"rendered":"Jstree and rename-Collection of common programming errors"},"content":{"rendered":"<p>Rename node in my jstree script doesn&#8217;t work&#8217;s, and J don&#8217;t know why, here is my script:<\/p>\n<pre><code>$(function () {\n $(\"#stworz_powiazanie\").click(function () {\n $(\"#pages-wrapper\").jstree(\"create\");\n    });\n$(\"#usun_powiazanie\").click(function () { \n    if(!confirm(\"Czy na pewno chcesz usunac te strone?\"))return;\n    $(\"#pages-wrapper\").jstree(\"remove\"); \n}); \n$(\"#zmien_nazwe\").click(function () {\n   $(\"#pages-wrapper\").jstree(\"rename\");\n});\n$(\"#cut\").click(function () { \n    $(\"#pages-wrapper\").jstree(\"cut\"); \n});\n$(\"#paste\").click(function () { \n    $(\"#pages-wrapper\").jstree(\"paste\"); \n});\n$(\"#pages-wrapper\").jstree({\n \"core\" : { \"initially_open\" : [ \"root\" ],\n            \"load_open\" :true,\n            \"animation\" :0,\n },\n\"html_data\" : {\n            \"ajax\" : {\n            \"url\" : \".\/pobierz.php\",\n            \"data\" : function (n) {\n                return { id : n.attr ? n.attr(\"id\") : 0 };\n            }\n        }           },\n    \"plugins\" : [\"themes\",\"html_data\",\"ui\",\"contextmenu\",\"crrm\",\"types\"],\n(............)\n\n$(\"#pages-wrapper\").bind(\"rename.jstree\", function (e, data) {\n        $.ajax({\n                type: \"POST\",\n                url: '.\/server.php',\n                 data: {\n                \"operation\" : \"rename_node\", \n                \"id\" : data.rslt.obj.attr(\"id\").replace(\"node_\",\"\"),\n                \"title\" : data.rslt.new_name\n                }, \n                success : function (r) {\n                    if(!r.status) {\n                        data.inst.refresh();\n                        alert('Zmieniono Nazwe');\n                    }\n                }\n        });\n    })\n}); \n});\n<\/code><\/pre>\n<p>from firebug J have report:<\/p>\n<p>TypeError: obj is undefined return obj.nodeValue;<\/p>\n<p>What is wrong with my script ? Can anyone check this and tell me what is wrong ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rename node in my jstree script doesn&#8217;t work&#8217;s, and J don&#8217;t know why, here is my script: $(function () { $(&#8220;#stworz_powiazanie&#8221;).click(function () { $(&#8220;#pages-wrapper&#8221;).jstree(&#8220;create&#8221;); }); $(&#8220;#usun_powiazanie&#8221;).click(function () { if(!confirm(&#8220;Czy na pewno chcesz usunac te strone?&#8221;))return; $(&#8220;#pages-wrapper&#8221;).jstree(&#8220;remove&#8221;); }); $(&#8220;#zmien_nazwe&#8221;).click(function () { $(&#8220;#pages-wrapper&#8221;).jstree(&#8220;rename&#8221;); }); $(&#8220;#cut&#8221;).click(function () { $(&#8220;#pages-wrapper&#8221;).jstree(&#8220;cut&#8221;); }); $(&#8220;#paste&#8221;).click(function () { $(&#8220;#pages-wrapper&#8221;).jstree(&#8220;paste&#8221;); }); $(&#8220;#pages-wrapper&#8221;).jstree({ &#8220;core&#8221; : [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2853","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2853"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2853\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}