Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery JQGrid数据未加载JSON数据_Jquery_Json_Jsp_Jqgrid - Fatal编程技术网

Jquery JQGrid数据未加载JSON数据

Jquery JQGrid数据未加载JSON数据,jquery,json,jsp,jqgrid,Jquery,Json,Jsp,Jqgrid,我不熟悉jQuery。在jQuery网格中加载数据时出现问题。在jqGrid中显示JSON数据时遇到问题 在我的firstpage.jsp中,我打印jQuery网格如下: jQuery(document).ready(function(){ jQuery("#list").jqGrid({ url: 'nybpayments_feeder.jsp?tranType='+tranType, mtype:'POST', datatype:"json", colNa

我不熟悉jQuery。在jQuery网格中加载数据时出现问题。在jqGrid中显示JSON数据时遇到问题

在我的firstpage.jsp中,我打印jQuery网格如下:

jQuery(document).ready(function(){
  jQuery("#list").jqGrid({
    url: 'nybpayments_feeder.jsp?tranType='+tranType,
    mtype:'POST',
    datatype:"json",
    colNames: ['Acctparty', 'Amount', 'Asofdate','Chipref'],

    colModel: [
      { name: 'acctparty', index: 'acctparty', width: 110, align: 'center', sorttype: 'string' },
      { name: 'amount', index: 'bmount',  width: 130, align: 'right', sorttype: 'float'},
      {name: 'asOfDate', index: 'asOfDate', width: 85, sorttype: 'date', align: 'center',datefmt: 'Y-m-d' },
      { name: 'chipref', index: 'chipref', width: 110, align: 'center', sorttype: 'string' },        
    ],

    pager: "#pager",
    rowNum: 5,
    rowList: [5,10, 20, 30,40],
    sortorder: "desc",
    viewrecords: true,
    gridview: true,
    autoencode: true,
    height:200,
    shrinkToFit:false,
    width:1250,
    loadonce:true,
    caption:"Compressed Billings:"}).navGrid('#pager',{edit:false,add:false,del:false,search:true,refresh:true})
});
{"total":10,"page":10,"records":10,"rows":[{"id":"1","cell":["\/IRELAND",1.5955875E8,"2013-12-30",null]},
                                           {"id":"2","cell":["\/IRELAND",1.3453294479E8,"2013-12-30",null]},{"id":"3","cell":[null,1.1684737776E8,"2013-12-30",null]}
服务器生成的字符串如下所示:

jQuery(document).ready(function(){
  jQuery("#list").jqGrid({
    url: 'nybpayments_feeder.jsp?tranType='+tranType,
    mtype:'POST',
    datatype:"json",
    colNames: ['Acctparty', 'Amount', 'Asofdate','Chipref'],

    colModel: [
      { name: 'acctparty', index: 'acctparty', width: 110, align: 'center', sorttype: 'string' },
      { name: 'amount', index: 'bmount',  width: 130, align: 'right', sorttype: 'float'},
      {name: 'asOfDate', index: 'asOfDate', width: 85, sorttype: 'date', align: 'center',datefmt: 'Y-m-d' },
      { name: 'chipref', index: 'chipref', width: 110, align: 'center', sorttype: 'string' },        
    ],

    pager: "#pager",
    rowNum: 5,
    rowList: [5,10, 20, 30,40],
    sortorder: "desc",
    viewrecords: true,
    gridview: true,
    autoencode: true,
    height:200,
    shrinkToFit:false,
    width:1250,
    loadonce:true,
    caption:"Compressed Billings:"}).navGrid('#pager',{edit:false,add:false,del:false,search:true,refresh:true})
});
{"total":10,"page":10,"records":10,"rows":[{"id":"1","cell":["\/IRELAND",1.5955875E8,"2013-12-30",null]},
                                           {"id":"2","cell":["\/IRELAND",1.3453294479E8,"2013-12-30",null]},{"id":"3","cell":[null,1.1684737776E8,"2013-12-30",null]}
在我的secondpage.jsp中,我正在用jsp打印json字符串,如下所示

response.setContentType("text/json");
ut.println(string);

您需要在jqgrid中具有
jsonReader
属性。而且colModel和json对象似乎不匹配。

它是如何不正确显示的?你有没有发现错误而不是显示错误?谢谢你重播史密斯。我没有在jsp中发现任何错误。jquery网格也没有显示。修改的金额字段也:{name:'amount',index:'amount',width:130,align:'right',sorttype:'float'},。代码中是否存在任何问题。请重新同步我现在可以在jquery网格中获取数据。请查找我所做的以下更改:现在我可以在jquery网格中获取数据。请查找我所做的以下更改:jsonReader:{root:“rows”,page:“page”,total:“total”,records:“records”,repeatitems:true,cell:“cell”,id:“id”,userdata:“userdata”,子网格:{root:“rows”,repeatitems:true,cell:“cell”},分页器:“#pager”,rowNum:1,rowList:[1,2,3,4,5],排序器:“desc”,viewrecords:true,gridview:true,自动编码:true,高度:200,收缩到位:false,宽度:5700,loadonce:true,标题:“压缩账单:”谢谢…谢谢你的重播skariya我添加了JsonReader如下:寻呼机:“#寻呼机”,行数:5,行列表:[5,10,20,30,40],排序器:“desc”,viewrecords:true,gridview:true,autoencode:true,高度:200,收缩因子:false,宽度:1250,loadonce:true,标题:“压缩账单:”,jsonReader:{repeatitems:true,单元格:“单元格”,id:“id”,userdata:“userdata”,root:“属性”,第页:“第页”,总计:“总计”,记录:“记录”}仍然数据没有显示,网格框也没有显示。请帮助我,我需要更改Json字符串对象中的内容并返回。现在我可以在jquery网格中获取数据。请查找我所做的以下更改:jsonReader:{root:“rows”,page:“page”,total:“total”,records:“records”,repeatitems:true,cell:“cell”,id:“id”,userdata:“userdata”,子网格:{root:“rows”,repeatitems:true,cell:“cell”},分页器:“#pager”,rowNum:1,rowList:[1,2,3,4,5],排序器:“desc”,viewrecords:true,gridview:true,自动编码:true,高度:200,收缩因子:false,宽度:5700,loadonce:true,标题:“压缩账单:”Thanksss。。。