使用jstree的一点疑问.解决可加分..请高手帮帮忙.
目前使用的版本为 "jstree_pre1.0 " . 为官方最新版...
在学习json作为数据源的过程中.
官方案例 http://www.jstree.com/documentation/json_data#.
出现这样一个问题:
//这是官方给出的demo , 可以绑定成功.
$(function () { $("#demo1").jstree({ "json_data": { "data": [ { //直接在这里拼接了一个json "data": "A node", "metadata": { id: 23 }, "children": ["Child 1", "A Child2"] }, { "attr": { "id": "li.node.id1" }, "data": { "title": "Long format demo", "attr": { "href": "#"}} }] }, "plugins": ["themes", "json_data", "ui"] }).bind("select_node.jstree", function (e, data) { alert(data.rslt.obj.data("id")); }); }); $(function () { $("#demo1").jstree({ "json_data": { "ajax": { //通过ajax获取json "url": "JstreeDo.aspx", "data": function (n) { return { id: n.attr ? n.attr("id") : 0 }; } } }, "plugins": ["themes", "json_data"] }); });