json 值的 jstree 给出了一些错误
jstree for json value is giving some error
我的Json:
[{"id":1,"text":"ungrouped","icon":"/icons/Group_16x16.png",
"parent":0,"dashboard":null,"childrenList":null}]
我的 jS:
// ajax demo
$('#ajax_topo').jstree({
'core' : {
'data' : {
'url' : './topology.json',
'data' : function (node) {
return { 'id' : node.id };
}
}
}
});
我的Html:
<h1>AJAX Topology demo</h1>
<div id="ajax_topo" class="demo"></div>
我收到这个
Error : Uncaught TypeError: Cannot read property 'children' of undefined
这是一个Json数组。所以你必须对其应用索引。
将node.id
替换为node[0].id
$('#ajax_topo').jstree({
'core' : {
'data' : {
'url' : './topology.json',
'data' : function (node) {
return { 'id' : node[0].id };
}
}
}
});
我的Json:
[{"id":1,"text":"ungrouped","icon":"/icons/Group_16x16.png",
"parent":0,"dashboard":null,"childrenList":null}]
我的 jS:
// ajax demo
$('#ajax_topo').jstree({
'core' : {
'data' : {
'url' : './topology.json',
'data' : function (node) {
return { 'id' : node.id };
}
}
}
});
我的Html:
<h1>AJAX Topology demo</h1>
<div id="ajax_topo" class="demo"></div>
我收到这个
Error : Uncaught TypeError: Cannot read property 'children' of undefined
这是一个Json数组。所以你必须对其应用索引。
将node.id
替换为node[0].id
$('#ajax_topo').jstree({
'core' : {
'data' : {
'url' : './topology.json',
'data' : function (node) {
return { 'id' : node[0].id };
}
}
}
});