我打算基于jquery的fancytree构建一个组件,但无论我对源数据做什么,文件夹深度都停留在3。是否有一些我无法发现的特殊树选项功能可以防止限制?
提前致谢。凯文
我使用的代码是:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Fancytree - Example</title>
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/jquery-ui.custom.js" type="text/javascript"></script>
<link href="../src/skin-xp/ui.fancytree.css" rel="stylesheet" type="text/css">
<script src="../src/jquery.fancytree.js" type="text/javascript"></script>
<script type="text/javascript">
var DT = $.ui.fancytree;
$.ui.fancytree.debug("Using fancytree " + $.ui.fancytree.version);
$("#foldertree").fancytree({
source: {
url: "data.json"
},
lazyload: function(e, data){
data.result = $.ajax({
url: "data.json",
dataType: "json"
});
}
});
// call methods on multiple instances
$("div:ui-fancytree").fancytree("foo", "after init");
});
</script>
</head>
<body class="example">
<div id="foldertree" data-source="ajax" class="">
</div>
<!-- (Irrelevant source removed.) -->
</body>
</html>
我正在使用的数据样本(我已经更改了很多次)但在下面添加了它以完成。我的观点是,我无法向下钻取超过 3 个文件夹,也无法在任何地方看到任何用于删除文件夹深度的树选项。
[
{"key": "top", "title": "Products", "folder": true, "children": [
{"key": "under1", "title": "A-E", "folder": true, "children": [
{"key": "under2", "title": "Parts 0-9", "folder": true , "children:": [
{"key": "under3", "title": "F-M", "folder": true, "children": [
{"key": "under4", "title": "F-M", "folder": true, "children": [
{"key": "under5", "title": "F-M", "folder": true, "children": [
{"key": "under6", "title": "F-M", "folder": true, "children": [
]}
]}
]}
]}
]}
]}
]},
{"key": "11", "title": "Samples", "folder": true, "children": [
{"key": "20", "title": "FG and H", "folder": true, "children": [
{"key": "30", "title": "Parts 0-9", "folder": true , "children:": [
{"key": "40", "title": "F-M", "folder": true, "children": [
{"key": "42", "title": "Sub-item 1.3.1", "folder": true, "children": [
{"key": "43", "title": "Sub-item 1.3.2"}
]},
{"key": "44_1", "title": "Sub-item 1.3.2"}
]}
]}
]}
]}
]