【发布时间】:2016-09-01 03:13:52
【问题描述】:
我在这方面做了足够多的研究,但仍然是个谜。
我从服务器中提取表模式以创建工作正常的列(result.colNames)和模型(result.colModel)。
在相同的结果上,我正在提取表数据(result.colD)以在成功时填充到 JQgrid 中。
成功后网格创建良好,但数据未加载到其中。
这里是代码和截图。
我在这方面花了很多时间,然后在这里发布..希望可以在这里解决。
$.ajax({
type: "GET",
url: "webapi/do/pullSchema/"+display,
data: "",
dataType: "json",
success: function(result)
{
colD = JSON.stringify(result.colData);
colN = result.colNames;
colM = result.colModel;
jQuery("#list").jqGrid({
data:JSON.parse(colD),datatype: "local",
colNames:colN, colModel :colM,
pager: jQuery('#pager'),
rowNum: 5,
rowList: [5, 10, 20, 50],
viewrecords: true,
caption: 'DAta from table',
loadtext:'Loading, please wait'});
},
error: function(x, e)
{
alert(x.readyState + " "+ x.status +" "+ e.msg);
}
});
以下是样本数据集:
[dbname=null, tables=null, ColNames=[Plan_code, LOB],
colModel=[{name:'Plan_code',index:'Plan_code',width:255}, {name:'LOB',index:'LOB',width:255}], colData=[{LOB=N, Plan_code=C82ACC}, {LOB=P, Plan_code=C82ACC}, {LOB=B, Plan_code=C82ACC}, {LOB=I, Plan_code=C82ACC}, {LOB=I, Plan_code=C82IRA}, {LOB=R, Plan_code=C82IRA}]
【问题讨论】: