0
我需要從一個JSON的文件中加載jsTree的文本菜單JSON的文件contecxtmenu。通過ContextMenu在這個文件( 「test.json」)保存:負荷使用JQuery.getJSON()
{
"item1" : {
"label" : "voce1"
},
"item2" : {
"label" : "voce2"
}
}
和代碼加載文本菜單是:
$(function() {
$("#tree").jstree({
"plugins" : [ "themes", "json_data", "ui", "contextmenu" ],
// other code ....
"contextmenu" : {
"items" : customMenu
}
})
});
function customMenu(node) {
$.getJSON("test.json", function(json) {
return json;
});
}
這樣,我沒有看到文本菜單。你可以幫我嗎?
感謝,這個問題很簡單 – Webman 2012-04-16 18:46:35
是不是Ajax調用異步或同步? – Radek 2012-04-17 22:34:28