jQuery MiniUI
标题:
关于动态列
[打印本页]
作者:
simple0145
时间:
2017-7-6 22:01:11
标题:
关于动态列
$.ajax({
url: bootPATH +"../r.do",
type: "post",
success: function (text) {
var data = mini.decode(text);
var jsontext=data.fields;
var co=[jsontext]//jsontext是一个字符串
alert(co);
grid.set({ columns: co});
/* grid.set({
columns: [
{ type: "indexcolumn" },
{ field: "age", width: 100, headerAlign: "center", allowSort: true, header: "年龄"},
{ field: "loginname", width: 120, headerAlign: "center", allowSort: true, header: "员工账号" }
]
});*/
}
});
alert出来的信息和注释中直接写的信息一致,为什么动态列出不来,就显示一个空白的横条,用注释中的可以正常显示。
不知是什么原因?
作者:
felt
时间:
2017-7-7 09:07:43
应该是你这co的数据格式不对,jsontext=data.fileds说明这个jsontext肯定不是几个对象,你又加了[],格式肯定和直接写出来的那个是不同的
作者:
simple0145
时间:
2017-7-7 09:56:35
felt 发表于 2017-7-7 09:07
应该是你这co的数据格式不对,jsontext=data.fileds说明这个jsontext肯定不是几个对象,你又加了[],格式肯 ...
谢谢,搞定了。
需要将jsontext中的每个"{...},{...}"都做mini.decode然后放入[]中。
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2