1
我現在需要了解jstree。我在我的一個項目中使用它。我需要關於使用ajax加載子節點的幫助。如何使用ajax加載jstree子節點?
我現在需要了解jstree。我在我的一個項目中使用它。我需要關於使用ajax加載子節點的幫助。如何使用ajax加載jstree子節點?
$('#treeloaddiv').jstree({
'core' : {
'data' : {
"url" : "/jstreedemo/JSTreeDemoServlet",
"type":"post",
"dataType" : "json",
"data" : function (node) {
return { "id" : node.id };
}
}
}
});
這是在servlet jstree v3的代碼在我的情況下,需要創建一個JSON對象和 設置兒童屬性爲true那麼每個孩子使用AJAX加載。 的JSON格式如下
JSONObject jsonobj = new JSONObject();
jsonobj.put("text","Root node");
jsonobj.put("children",true);
希望它能幫助我也停留在這一點上很多天。
希望這有助於:http://stackoverflow.com/questions/26270239/creating-dynamic-jstree-using-alternative-json-format-stored-in-array/26299310#26299310 – 2014-11-04 10:41:00
使一個正常的jquery ajax調用和每當你用新的url進行ajax調用時,將響應指定給arrayCollection並以這種方式刷新樹:$('#jstree')。jstree(true).settings.core.data = arrayCollection; $( '#jstree')jstree(真).REFRESH()。 – 2014-11-04 10:44:28