我有一個問題,我需要在jqgrid上顯示json數據。我得到的數據是格式如下:麻煩在jqgrid上顯示json數據和格式
{"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"}}
我的JavaScript來顯示的數據是:
$("#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
});
我嘗試了一些組合,但不能得到被顯示在jqGrid的數據與此代碼。 jqgrid顯示一個空表。我想我在這裏失去了一些東西。
我還必須格式化數據,以便每當我們點擊'\ n'時,我們都會將它顯示在新行中。我想我可以在列的格式化程序中使用'addrowdata'來做到這一點。是對的嗎?
任何指針,非常感謝。
感謝,
阿莎
感謝奧列格,工作像一個魅力與一些變化。我必須做出更改,因爲我在發佈數據時錯過了一些內容,並且我可以免費搜索/過濾。有一個問題,有沒有辦法在搜索文本框旁邊添加一個過濾器圖標。再次感謝。 – Alice