- 注册时间
- 2013-2-26
- 最后登录
- 2013-5-23
- 阅读权限
- 10
- 积分
- 119
- 精华
- 0
- 帖子
- 31
|
本帖最后由 3078825 于 2013-3-12 14:38 编辑
LazyTree 懒加载树形当父节点存在节点名称(ID)为message的节点时,子节点无法加载
测试代码
- <ul id="table_tree" class="mini-tree" showTreeIcon="true" leafIcon="mini-tree-folder" showTreeIcon="true" textField="name" onbeforeload="onBeforeTreeLoad" onbeforeexpand="onBeforeExpand" idField="name" parentField="pid" resultAsTree="false"></ul>
- <script type="text/javascript">
- mini.parse();
- function onBeforeExpand(e) {
- var tree = e.sender;
- var nowNode = e.node;
- var root = tree.getRootNode();
- tree.cascadeChild(root, function (node) {
- if (tree.isExpandedNode(node)) {
- if (node != nowNode && !tree.isAncestor(node, nowNode)) {
- tree.collapseNode(node, true);
- }
- }
- });
- }
- function onBeforeTreeLoad(e) {
- var tree = e.sender; //树控件
- var node = e.node; //当前节点
- var params = e.params; //参数对象
- }
- mini.get('table_tree').load("/tree.php");
- </script>
复制代码
PHP代码:
- <?php
- $name = empty($_REQUEST['name']) ? '' : trim($_REQUEST['name']);
- if(empty($name))
- {
- echo '[{"id":1,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"admin"},{"id":2,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"admin_group"},{"id":3,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"loginlog"},{"id":4,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"message"},{"id":5,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"module"},{"id":6,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"session"},{"id":7,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"weather"}]';
- }
- else
- {
- echo "[{\"id\":1,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"id\"},{\"id\":2,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"tuid\"},{\"id\":3,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"tfullname\"},{\"id\":4,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"uid\"},{\"id\":5,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"ufullname\"},{\"id\":6,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"message\"},{\"id\":7,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"date\"},{\"id\":8,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"status\"},{\"id\":9,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"tdel\"},{\"id\":10,\"isLeaf\":true,\"type\":\"txt\",\"pid\":\"$name\",\"folder\":0,\"name\":\"udel\"}]";
- }
- ?>
复制代码
父级json
- [{"id":1,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"admin"},{"id":2,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"admin_group"},{"id":3,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"loginlog"},{"id":4,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"message"},{"id":5,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"module"},{"id":6,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"session"},{"id":7,"isLeaf":false,"type":null,"pid":-1,"folder":1,"name":"weather"}]
复制代码 message 节点json- [{"id":1,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"id"},{"id":2,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"tuid"},{"id":3,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"tfullname"},{"id":4,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"uid"},{"id":5,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"ufullname"},{"id":6,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"message"},{"id":7,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"date"},{"id":8,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"status"},{"id":9,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"tdel"},{"id":10,"isLeaf":true,"type":"txt","pid":"message","folder":0,"name":"udel"}]
复制代码
只有父级为message的节点不能展开,如果我把父级的message改成messagex就可以问题。
是不是父节点不能命名为message?
|
|