JSP でコードを記述し、JqGrid でデータを表示するために JSON オブジェクトを使用しました。
JSON オブジェクトにデータがあることはわかっていますが (その内容をログに記録しました)、JqGrid に表示されません。JSON データを JSON 文字列にコピーすると、Jqgrid に読み込まれて正常に表示されます。
これは私のJSPコードです:
JSONObject responcedata = new JSONObject();
responcedata.put("total",totalrow);
responcedata.put("page",cpage);
responcedata.put("records",rcount);
Report obj = new Report();
responcedata = obj.ReportGrid(responcedatal);
System.out.println(responcedata);
これは私のJSONオブジェクトの内容です:
{"total":"21″,"rows":[{"cell":["HS","H","10","5","G","9288"],"id":" 1″},{"セル":["",null,null,null,"G","2099"],"id":"2″},{"セル":["HS","F" ,"3","53","G","86578"],"id":"3″},{"セル":["HS","F","7","26"," G","8268"],"id":"4"},{"セル":["HS","F","8","54","G","221"],"id ":"5″},{"セル":["HS","F","5","77","G","1020"],"id":"6″},{"セル":["HS","H","14","14","G","73334"],"id":"7"},{"セル":["HS","C","21","1 ","G&B","1512"],"id":"8"},{"セル":["HS","F","2","105","G","4960"] ,"id":"9″},{"セル":["HS","F","4","21","G","86889"],"id":"10″}] ,"レコード":11}G","4960"],"id":"9"},{"セル":["HS","F","4","21","G","86889"],"id ":"10″}],"レコード":11}G","4960"],"id":"9"},{"セル":["HS","F","4","21","G","86889"],"id ":"10″}],"レコード":11}
この JSON 文字列を使用すると、JqGrid にデータが表示されます。JSON オブジェクト、変数responcedata
(上記のコード) を使用すると、読み込みのみが表示され、データは表示されません。