jQuery MiniUI

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

请教一下grid动态表头和加载值的问题 [复制链接]

Rank: 1

跳转到指定楼层
楼主
发表于 2017-3-21 10:38:45 |只看该作者 |倒序浏览
表头数据为:{columns:[ { type: "indexcolumn" ,header:"序号",headerAlign:"center"},{ filed:"SPT",headerAlign: "center",  header: "监测时间",width: 100  },{filed:"STNM", headerAlign: "center",  header: "站名",width: 100  }    ,{filed:"WT",header:"水温度",headerAlign:"center",width:100},{filed:"CLARITY",header:"透明度m",headerAlign:"center",width:100},{filed:"PH",header:"酸碱度PH",headerAlign:"center",width:100},{filed:"COND",header:"电导率us/CM",headerAlign:"center",width:100},{filed:"DOX",header:"溶解氧mg/L",headerAlign:"center",width:100},{filed:"CODMN",header:"高锰酸盐指数mg/L",headerAlign:"center",width:100},{filed:"CODCR",header:"化学需氧量mg/L",headerAlign:"center",width:100},{filed:"TP",header:"总磷mg/L",headerAlign:"center",width:100},{filed:"DTP",header:"可溶性总磷mg/L",headerAlign:"center",width:100},{filed:"NH3N",header:"氨氮mg/L",headerAlign:"center",width:100},{filed:"TN",header:"总氮mg/L",headerAlign:"center",width:100},{filed:"CHLA",header:"叶绿素mg/L",headerAlign:"center",width:100},{filed:"ZMD",header:"藻密度万个细胞/L",headerAlign:"center",width:100}]}
内容为:[{"JL_PER":"黄莉","WT":"","CODMN":"","TN":"","CLARITY":"","STNM":"松浦大桥","TP":"","CHLA":"","CODCR":"","PH":"","JY_PER":"","NH3N":"0.58","SPT":"2017-03-13 00:00:00","COND":"","DOX":"","DTP":""},{"JL_PER":"黄莉","WT":"","CODMN":"","TN":"","CLARITY":"","STNM":"松浦大桥","TP":"","CHLA":"","CODCR":"","PH":"","JY_PER":"","NH3N":"0.55","SPT":"2017-03-14 00:00:00","COND":"","DOX":"","DTP":""},{"JL_PER":"黄莉","WT":"","CODMN":"","TN":"","CLARITY":"","STNM":"松浦大桥","TP":"","CHLA":"","CODCR":"","PH":"","JY_PER":"","NH3N":"0.49","SPT":"2017-03-15 00:00:00","COND":"","DOX":"","DTP":""},{"JL_PER":"黄莉","WT":"","CODMN":"","TN":"","CLARITY":"","STNM":"松浦大桥","TP":"","CHLA":"","CODCR":"","PH":"","JY_PER":"","NH3N":"0.47","SPT":"2017-03-16 00:00:00","COND":"","DOX":"","DTP":""},{"JL_PER":"黄莉","WT":"","CODMN":"","TN":"","CLARITY":"","STNM":"松浦大桥","TP":"","CHLA":"","CODCR":"","PH":"","JY_PER":"","NH3N":"0.35","SPT":"2017-03-17 00:00:00","COND":"","DOX":"","DTP":""},{"JL_PER":"黄莉","WT":"","CODMN":"","TN":"","CLARITY":"","STNM":"松浦大桥","TP":"","CHLA":"","CODCR":"","PH":"","JY_PER":"","NH3N":"0.37","SPT":"2017-03-18 00:00:00","COND":"","DOX":"","DTP":""},{"JL_PER":"黄莉","WT":"","CODMN":"","TN":"","CLARITY":"","STNM":"松浦大桥","TP":"","CHLA":"","CODCR":"","PH":"","JY_PER":"","NH3N":"0.41","SPT":"2017-03-19 00:00:00","COND":"","DOX":"","DTP":""}]
请问怎么写能显示出来。

Rank: 8Rank: 8

沙发
发表于 2017-3-21 10:55:03 |只看该作者
var columns=表头数据
grid.setColumns(columns.columns)
var data=内容
grid.setData(data)

Rank: 1

板凳
发表于 2017-3-21 11:20:20 |只看该作者
felt 发表于 2017-3-21 10:55
var columns=表头数据
grid.setColumns(columns.columns)
var data=内容

照你写的做的,可是什么都显示不出来,也不报错。我还用colunms = mini.encode(colunms);这个转了一下还是不行

Rank: 1

地板
发表于 2017-3-21 11:29:32 |只看该作者
felt 发表于 2017-3-21 10:55
var columns=表头数据
grid.setColumns(columns.columns)
var data=内容

有写好的例子参考一下吗,带数据可以显示的那种

Rank: 8Rank: 8

5#
发表于 2017-3-21 12:23:54 |只看该作者
本帖最后由 jialiang 于 2017-3-21 12:25 编辑
d984881239 发表于 2017-3-21 11:29
有写好的例子参考一下吗,带数据可以显示的那种

我用你的数据和自己做的数据,你的数据有问题的,你的field和内容中的不匹配可以看下我做的例子更改一下数据:
附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册

Rank: 1

6#
发表于 2017-3-21 13:36:09 |只看该作者
jialiang 发表于 2017-3-21 12:23
我用你的数据和自己做的数据,你的数据有问题的,你的field和内容中的不匹配可以看下我做的例子更改一下数 ...

好的,谢谢。

Rank: 1

7#
发表于 2017-3-21 13:53:42 |只看该作者
jialiang 发表于 2017-3-21 12:23
我用你的数据和自己做的数据,你的数据有问题的,你的field和内容中的不匹配可以看下我做的例子更改一下数 ...

我找到问题出在哪里了  那个时间后面有 00:00:00这个东西数据就显示不出来的

Rank: 1

8#
发表于 2017-3-21 14:12:39 |只看该作者
jialiang 发表于 2017-3-21 12:23
我用你的数据和自己做的数据,你的数据有问题的,你的field和内容中的不匹配可以看下我做的例子更改一下数 ...

我如果数据想显示2017-03-21 00:00:00 这样的时间 需要改哪里呢

Rank: 8Rank: 8

9#
发表于 2017-3-21 14:39:43 |只看该作者
d984881239 发表于 2017-3-21 14:12
我如果数据想显示2017-03-21 00:00:00 这样的时间 需要改哪里呢

url加载的数据yyyy-MM-dd HH:mm:ss和yyyy-MM-ddTHH:mm:ss两种格式的数据都会自动解析成date,
对应到表格上,可以设置某列的显示形式,dateForamt=“yyyy-MM-dd HH:mm:ss”

Archiver|普加软件

GMT+8, 2024-11-26 19:44 , Processed in 1.029792 second(s), 11 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部