javascript – 具有本地数组数据的jQuery花式树
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了javascript – 具有本地数组数据的jQuery花式树,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2083字,纯文字阅读大概需要3分钟。
内容图文
我正在尝试使用本地数组数据实现jQuery FancyTree http://wwwendt.de/tech/fancytree/demo/
从https://code.google.com/p/fancytree/开始
这是代码.但它不起作用,没有脚本错误.但树是空的!
Even i copied the jQuery, UI versions of the file they using in a demo
site. Still nothing works
<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>
解决方法:
我注意到source:[]是你在$(“#tabTree”).fancytree()初始化调用中初始化树的方法,所以你的例子是:
<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);
},
source: [ // 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>
顺便说一句,如果你注意到它,文档很乱,因为它们正在重构代码,文档是dynatree和fancytree的新约定的一半.所以期待更多奇怪的东西:-)
内容总结
以上是互联网集市为您收集整理的javascript – 具有本地数组数据的jQuery花式树全部内容,希望文章能够帮你解决javascript – 具有本地数组数据的jQuery花式树所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。