我在 JSP 中编写了代码,并使用 JSON 对象在 JqGrid 中显示数据。
我知道我的 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″},{"cell":["",null,null,null,"G","2099"],"id":"2″},{"cell":["HS","F" ,"3","53","G","86578"],"id":"3″},{"cell":["HS","F","7","26"," G","8268"],"id":"4″},{"cell":["HS","F","8","54","G","221"],"id ":"5″},{"cell":["HS","F","5","77","G","1020"],"id":"6″},{"cell ":["HS","H","14","14","G","73334"],"id":"7″},{"cell":["HS","C","21","1 ","G&B","1512"],"id":"8″},{"cell":["HS","F","2","105","G","4960"] ,"id":"9″},{"cell":["HS","F","4","21","G","86889"],"id":"10″}] “记录”:11}G","4960"],"id":"9″},{"cell":["HS","F","4","21","G","86889"],"id ":"10″}],"记录":11}G","4960"],"id":"9″},{"cell":["HS","F","4","21","G","86889"],"id ":"10″}],"记录":11}
我使用了这个 JSON 字符串,而 JqGrid 正在显示数据。当我使用 JSON 对象时,变量responcedata
(在上面的代码中)只显示加载,但从不显示数据。