I have a problem where I need to display json data on a jqgrid. The data I get is of the following format:
{"data":{"data":"\tat org.aaa.aaa.aaa.aaa.aaa.aaa(aaa.java:512)[147:org.aaa.aaa.aaa:9.1.1]\n\tat aaa.aaa.aaa.aaa.aaa.aaa(aaa.java:1789)[146:org.aaa:9.1.1]\n"}}
My javascript to display the data is:
$("#grid").jqGrid({
url: '/getdata',
datatype: "json",
mtype: "GET",
colNames:['data'],
colModel:[
{name:'data', index:'data', align:'center'}
],
jsonReader : {
repeatitems: false,
id: "0",
cell: "",
root: "logs",
page: function() { return 1; },
total: function() { return 1; },
records: function(obj) { return obj.length; }
},
loadonce: true,
viewrecords: true,
autowidth: true,
multiselect: false,
ignoreCase: true,
sortable: true,
height: 600,
rowNum: 999
});
I tried a few combinations, but could not get the data to be displayed on the jqgrid with this code. The jqgrid displays an empty table. I guess I am missing something here.
I also have to format the data so that every time we hit '\n', we display it in a new row. I guess I can use 'addrowdata' in the formatter for the column to do that. Is that right?
Any pointers are greatly appreciated.
thanks,
Asha