1 |
- <!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>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<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 type="text/javascript">
var manager = null;
$(function ()
{
$("#tree1").ligerTree(
{
data:[{"id":"1","pid":"0","children":[],"text":"综合","isexpand":"false",}],
idFieldName :'id',
parentIDFieldName :'pid',
nodeWidth : 200,
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, [{id:"2" , text: "111" }]);
}
}
function onExpand(note)
{
}
</script>
</head>
<body style="padding:10px">
<h4>模拟异步动态加载节点</h4>
<div style="width:400px; height:500px;">
<ul id="tree1" >
</ul>
</div>
<div style="display:none">
</div>
</body>
</html>
|