http://demo.scsn.gov.cn/admin/test/jqgrid.aspx
http://demo.scsn.gov.cn/admin/test/jqgrid.ashx上面两个页面分别是jqgrid的显示页和json返回页,为什么jqgrid始终不显示数据呢

解决方案 »

  1.   

    jqgrid的源代码一般要手工修改了才能用,不改的话,“潜规则”引起的问题比较多
      

  2.   

    下面是jqGrid的定义 $("#list").jqGrid({
    url: 'jqgrid.ashx',
    datatype: 'json',
    //mtype: 'get',
    multiselect: true,
    multiboxonly: true,
    //toolbar:[true,'top'],
    altRows: true,
    altclass: 'altclass',
    width: 1000,
    height: 500,
    colNames: ['编号', '国家', '省份', '城市', '区县', '邮编','区号'],
    colModel: [
    {name:'id',index:'id',width:55},
    {name:'Country',index:'Country',width:90},
    {name:'Province',index:'Province',width:80},
    {name:'City',index:'City',width:80,align:'right'},
    {name:'Area',index:'Area',width:80},
    {name:'PostCode',index:'PostCode',width:80},
    {name:'AreaCode',index:'AreaCode',width:150, sortable: false}],
    pager: '#pager',
    rowNum: 50,
    rowList: [10, 20, 30,50],
    //viewrecords: true,
    //jsonReader:{repeatitems:false },
    caption: 'My first grid'
    });
    下面是ashx返回的json,应该没有问题啊{"page":"1","total":"50","records":"2917",
    "rows":[
    {id:"1",cell:["1","中华人民共和国","北京市","东城区","","100000","010"]},
    {id:"2",cell:["2","中华人民共和国","北京市","西城区","","100000","010"]},
    {id:"3",cell:["3","中华人民共和国","北京市","崇文区","","100000","010"]},
    {id:"4",cell:["4","中华人民共和国","北京市","宣武区","","100000","010"]},
    {id:"5",cell:["5","中华人民共和国","北京市","朝阳区","","100000","010"]},
    ……
    {id:"46",cell:["46","中华人民共和国","天津市","大港区","","300200","022"]},
    {id:"47",cell:["47","中华人民共和国","天津市","东丽区","","300000","022"]},
    {id:"48",cell:["48","中华人民共和国","天津市","西青区","","300000","022"]},
    {id:"49",cell:["49","中华人民共和国","天津市","津南区","","300000","022"]},
    {id:"50",cell:["50","中华人民共和国","天津市","北辰区","","300000","022"]}
    ]
    }
      

  3.   

    建议你用eval转换成js对象,再用FireDebug跟踪一下,看page、total这些属性正确没有
      

  4.   

    谢谢,属性是正确的,另外,如果在ashx中设置了context.Response.ContentType = "application/json";访问这个ashx就会出现如下提示,如果去掉context.Response.ContentType = "application/json";就没有提示无法显示 XML 页。 
    使用 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。 
    --------------------------------------------------------------------------------文档的顶层无效。处理资源 'http://demo.scsn.gov.cn/admin/test/jqgrid.ashx' 时出错。第 1 行,位置: 1  
      

  5.   

    终于解决了,原来是网上查找的jqgrid标准格式,也不标准,{id:"2",cell:类似这样的地方,一定要加引号{"id":"2","cell":
      

  6.   

    注册几年了,原来这还是第一次发贴呢,3楼虽然没解决我的问题,但让我知道了eavl的用法,还是要谢谢,所以给分了