jQuery MiniUI

 找回密码
 立即注册
查看: 2646|回复: 1
打印 上一主题 下一主题

treegrid 动态加载请教 [复制链接]

Rank: 4

跳转到指定楼层
楼主
发表于 2013-4-3 11:42:15 |只看该作者 |倒序浏览
treegrid 定义:
<div id="ml_total" class="mini-treegrid" treeColumn="xm1" style="width:100%;height:100%;" showTreeIcon="true" idField="xm" parentField="xm0" resultAsTree="false"></div>

表头定义:
var col_str = [{ "field": "xm", "name": "xm", "width": "50", "align": "center", "headerAlign": "center", "header": "序号" }, { "field": "xm1", "name": "xm1", "width": "50", "align": "center", "headerAlign": "center", "header": "类别" }, { "field": "xm2", "name": "xm2", "width": "50", "align": "center", "headerAlign": "center", "header": "条数" }, { "header": "错误条数", "headerAlign": "center", columns: [{ "field": "xm3", "width": "50", "align": "center", "headerAlign": "center", "header": "合计" }, { "field": "xm4", "width": "50", "align": "center", "headerAlign": "center", "header": "苗子" }, { "field": "xm5", "width": "50", "align": "center", "headerAlign": "center", "header": "甲" }, { "field": "xm6", "width": "50", "align": "center", "headerAlign": "center", "header": "乙" }, { "field": "xm7", "width": "50", "align": "center", "headerAlign": "center", "header": "丙"}]}];


数据文件TJ.TXT内容:
[{xm:'1',xm0:-1,xm1:'命令总数',xm2:'195',xm3:'0',xm4:'0',xm5:'0',xm6:'0',xm7:'0'},{xm:'2',xm0:'1',xm1:'H',xm2:'17',xm3:'',xm4:'',xm5:'',xm6:'',xm7:''},{xm:'3',xm0:'1',xm1:'A',xm2:'10',xm3:'',xm4:'',xm5:'',xm6:'',xm7:''},{xm:'4',xm0:'1',xm1:'B',xm2:'7',xm3:'',xm4:'',xm5:'',xm6:'',xm7:''},{xm:'5',xm0:'1',xm1:'B',xm2:'10',xm3:'',xm4:'',xm5:'',xm6:'',xm7:''},{xm:'6',xm0:'1',xm1:'D',xm2:'15',xm3:'',xm4:'',xm5:'',xm6:'',xm7:''},{xm:'7',xm0:'1',xm1:'E',xm2:'10',xm3:'',xm4:'',xm5:'',xm6:'',xm7:''}]

代码:
            var grid1 = mini.get("ml_total");
            grid1.setColumns(col_str);
            grid1.setUrl("scripts/tj.txt");
            grid1.load();
运行后只能显示表头,没有数据。不知哪里出错了。

Rank: 9Rank: 9Rank: 9

沙发
发表于 2013-4-3 12:24:38 |只看该作者
1)height为auto
2)tj.txt注意大小写
3)grid1.load()去掉
4)更新下最新版本:http://www.miniui.com/download/

Archiver|普加软件

GMT+8, 2024-11-28 01:38 , Processed in 1.028526 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部