- 注册时间
- 2012-7-23
- 最后登录
- 2014-12-12
- 阅读权限
- 10
- 积分
- 418
- 精华
- 0
- 帖子
- 113
|
我看到这里 http://miniui.com/demo/tree/lazytree.html
我下载了演示,看到加载数据代码,好像是一次性全部加载的啊.
,而不是点节点后,加载下级节点的内容
- public void LoadNodes()
- {
- String id = Request["id"];
- if (String.IsNullOrEmpty(id)) id = "-1";
- //获取下一级节点
- String sql = "select * from plus_file where pid = '" + id + "' order by updatedate";
- ArrayList folders = DBUtil.Select(sql);
- //判断节点,是否有子节点。如果有,则处理isLeaf和expanded。
- for (int i = 0, l = folders.Count; i < l; i++)
- {
- Hashtable node = (Hashtable)folders[i];
- String nodeId = node["id"].ToString();
- String sql2 = "select * from plus_file where pid = '" + nodeId + "' order by updatedate";
- ArrayList nodes = DBUtil.Select(sql2);
- if (nodes.Count > 0)
- {
- node["isLeaf"] = false;
- node["expanded"] = false;
- }
- }
- //返回JSON
- String json = PluSoft.Utils.JSON.Encode(folders);
- Response.Write(json);
- }
复制代码
|
|