I'm having some problem loading json data locally, I've tried both example that I found here http://stackoverflow.com/questions/6831306/load-local-json-data-in-jqgrid-without-addjsonrows but neither work for me. Here is my current configuration. In this case metaData is the object I pass into $().jqGrid() and recent changes is any array of JSON objects that I'm trying to load
var recentChanges =[
{“id”:41, “lastModified”:”2012-11-15 11:58:56″, “login”:”admin”, “name”:”store-01_proxy”, “revision”:”Modified”, “type”:”Messaging Proxy”},
{“id”:96, “lastModified”:”2013-03-19 13:05:41″, “login”:”admin”, “name”:”store-01_asset”, “revision”:”Modified”, “type”:”Deployed Virtual Asset”},
{“id”:31, “lastModified”:”2012-11-06 10:55:56″, “login”:”admin”, “name”:”numbers_proxy”, “revision”:”Modified”, “type”:”Messaging Proxy”}
{“id”:95,”lastModified”:”2013-03-19 13:05:39″, “login”:”admin”, “name”:”numbers_asset”, “revision”:”Modified”, “type”:”Deployed Virtual Asset”}
{“id”:97,”lastModified”:”2013-03-19 13:05:42″, “login”:”admin”, “name”:”calculator_asset”, “revision”:”Modified”, “type”:”Deployed Virtual Asset”}
];
var reader = {
root : 'dataList',
repeatitems : false,
page : function(args) {
if (args.totalDataCount === args.dataList.length) {
return 1;
}
},
total : function(args) {
return 1;
},
records : function(args) {
return args.dataList.length;
},
};
var metaData = {};
metaData.rowNum = 15;
metaData.rowList = [15, 50, 100, 'ALL'];
metaData.width = 548;
metaData.datatype = 'jsonstring';
metaData.datastr = JSON.stringify({dataList : recentChanges});
metaData.height = “100%”;
metaData.jsonReader = reader;
metaData.localReader = reader;
metaData.colNames = ['id', 'resourceType', intl_strings[“component_name”], intl_strings[“component_type”], intl_strings[“label_last_modified”], intl_strings[“label_modification_user”], intl_strings[“label_modification_revision”]];
metaData.colModel = [
{ name: 'id', key : true, hidden: true, jsonmap : 'id' },
{ name: 'resourceType', key : false, hidden: true, jsonmap : 'resourceType' },
{ name: 'name', index: 'name', sortable: true, search : false, jsonmap : 'name'},
{ name: 'type', index:'type', sortable: true, search : false, jsonmap : 'type' },
{ name: 'lastModified', index: 'lastModified', sortable : true, search : false, jsonmap : 'lastModified' },
{ name: 'login', index: 'login', sortable : true, search : false, jsonmap : 'login' },
{ name: 'revision', index: 'revision', sortable : true, search : false, jsonmap : 'revision'},
];
Any help would be appreciated. I've also tried using the addJSONData method to no avail;