123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- <script src="../../lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
- <link href="../../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
- <script src="../../lib/ligerUI/js/core/base.js" type="text/javascript"></script>
- <script src="../../lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
- <script src="../../lib/ligerUI/js/plugins/ligerTip.js" type="text/javascript"></script>
- <script type="text/javascript">
- var manager = null;
- $(".l-tree .l-body span").live('mouseover', function (e) {
- if (!this.title)
- this.title = $(this).text();
- });
- $(function ()
- {
- $("#tree1").ligerTree(
- {
- url: 'tree.json',
- nodeWidth : 40,
- onBeforeExpand: onBeforeExpand,
- onExpand: onExpand
- });
- manager = $("#tree1").ligerGetTreeManager();
- });
-
- function onBeforeExpand(note)
- {
- if (note.data.children && note.data.children.length == 0)
- {
- //这里模拟一个加载节点的方法,append方法也用loadData(target,url)代替
- manager.append(note.target, [
- { text: note.data.text + "'s child1" },
- { text: note.data.text + "'s child2" },
- { text: note.data.text + "'s child3" }
- ]);
- }
- }
- function onExpand(note)
- {
- }
-
- </script>
- </head>
- <body style="padding:10px">
- <h4>模拟异步动态加载节点</h4>
- <div style="width:400px; height:500px;">
- <ul id="tree1" >
- <li isexpand="false"><span>第一个节点</span><ul></ul></li>
- <li isexpand="false"><span>第二个节点</span><ul></ul></li>
- </ul>
- </div>
- <div style="display:none">
-
- </div>
- </body>
- </html>
|