OK. I have been going through many answers here but none of them worked. What i am trying to do is show my JSON
response in jqgrid
. But it shows this error:
error:
Here is the code:
var cols = ['VNo', 'Notes', 'Title'];
var colmodel = [
{ key: true, hidden: false, name: 'VNo', index: 'VNo' },
{ key: false, hidden: false, name: 'Notes', index: 'Notes' },
{ key: false, hidden: false, name: 'Title', index: 'Title' }
];
alert(colmodel.length);
$('#grid').jqGrid({
url: "/Voucher/GetJournalVouchers",
datatype: 'json',
mtype: "GET",
colNames:cols,
ColModel:colmodel,
pager: jQuery('#pager'),
rowNum: 10,
rowList: [10, 20, 30, 40],
height: '100%',
viewreocrds: true,
caption: 'Vouchers',
emptyrecords: 'No records to display',
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
id: "0"
},
autowidth: true,
multiselect: false,
});
if I remove colNames it shows jqGrid but doesn't load any data. Here is JSON
response I receive after removing colNames:
Change ColModel:colmodel,
tocolModel:colmodel,
in grid definition. Its a spell mistake.