我想實現的jQuery FancyTree http://wwwendt.de/tech/fancytree/demo/從https://code.google.com/p/fancytree/jQuery的花式樹與本地陣列數據
這指本地陣列數據
是代碼。但它不工作,沒有腳本錯誤。但樹是空的!
即使我複製的文件,他們在演示 網站使用jQuery,UI版本。不過沒有什麼作品
<html>
<head>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery-ui.custom.js" type="text/javascript"></script>
<link href="ui.fancytree.css" rel="stylesheet" type="text/css" />
<script src="jquery.fancytree.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#tree").fancytree({
onActivate: function (node) {
// A DynaTreeNode object is passed to the activation handler
// Note: we also get this event, if persistence is on, and the
// age is reloaded.
alert("You activated " + node.data.title);
},
children: [ // Pass an array of nodes.
{title: "Item 1" },
{ title: "Folder 2", isFolder: true,
children: [
{ title: "Sub-item 2.1" },
{ title: "Sub-item 2.2" }
]
},
{ title: "Item 3" }
]
});
});
</script>
</head>
<body>
<div id="tree">
</div>
</body>
</html>
你是對的。但是用花式樹,我無法在每個子節點中調用渲染方法,因爲它在dyna樹中使用。它說parent.ul爲空:( – Billa 2013-02-21 04:43:17
我不明白你的意思是「在每個孩子節點的渲染方法」... – zmo 2013-02-21 10:24:43
我說這個。var childNodes = node.getChildren(); if(childNodes (已經被選擇)childNodes [i] .data。(已經被選擇){已經被選擇的子元素[i] .data.select; )(var i = 0; i
Billa
2013-02-21 12:54:51