如何在select_node
事件中爲jstree添加元數據。這是我在嘗試添加:如何在select_node事件上爲jstree添加元數據
$.ajax({
type : 'GET',
url : '/assessment/getassess',
dataType : 'json',
success : function(jsonData) {
$("#treeViewDiv").jstree({
"themes" : {
"theme" : "classic",
"dots" : true,
"icons" : true,
"url" : "/css/themes/classic/style.css"
},
"json_data" : jsonData,
"plugins" : ["themes", "json_data", "ui", "contextmenu"],
"contextmenu" : {
items : createMenu
}
}).bind("select_node.jstree", function(e, data) {
$(data.rslt.obj).data("jstree").description = "Size: 45units";
});
}
});
你做了一些研究嗎? – Jesse 2013-03-08 11:25:24
是的,我做過。當我使用alert(data.rslt.obj.data(「id」));在節點的select_node上,它顯示了適當的值,但是當我嘗試給它分配一些內容時。它不起作用 – userguested 2013-03-12 09:37:31
你能展示更多的代碼嗎?從上面的代碼行很難幫助/解決您的問題。我認爲你應該更充實你的問題 - 看看[如何問](http://stackoverflow.com/faq#howtoask)。 – Jesse 2013-03-12 10:03:27