hi iam使用jqgrid reloadGrid和本地json。当重装网格为空或未填充时 这个演示demo 这是我的代码
function FillGrid() {
var objstr = [{ id: "12", Name: "Name 41", PackageCode: "8443123a", get: 315 },
{ id: "22", Name: "Name 12", PackageCode: "8314423a", get: 585 },
{ id: "32", Name: "Name 12", PackageCode: "8314423a", get: 56485 }
]
var col = Object.keys(objstr).map(function (itm) { return objstr[itm]; });
// $("#" + idgrid).setGridParam({ data: col }).trigger("reloadGrid", { page: 1 });
$("#jqg1").setGridParam({ data: objstr, datatype: 'local' }).trigger('reloadGrid');
}
答案 0 :(得分:0)
在我看来,您在FillGrid
中输入了错误。固定版本
function FillGrid() {
var objstr = [
{ id: "12", Name: "Name 41", PackageCode: "8443123a", get: 315 },
{ id: "22", Name: "Name 12", PackageCode: "8314423a", get: 585 },
{ id: "32", Name: "Name 12", PackageCode: "8314423a", get: 56485 }
];
$("#packages").setGridParam({
data: objstr,
datatype: 'local'
}).trigger('reloadGrid');
}