nickzhou99
nickzhou99
采纳率100%
2016-05-12 14:43

easyui解析后台传回的json报错

10
已采纳

前台JS:

 $('#table').datagrid({
        fit:true,
        fitColumns:true,
        pagination:true,
        pagination:true,
        pageList:[5,15,30,50],
        pageSize:15,
        title:'实验室列表',
        iconCls:'icon-search',
        url:'getAllLabInfo',
        remoteSort:true,
        striped:true,
        fitColumns:true,
        rownumbers:true,
        remoteSort:false,
        toolbar:'#tb',
        columns:[
        {
            title:'编号',
            field:'id',
            width:60,
            sortable:true,
            align:'center',
            halign:'center',
        },
        {
            title:'实验室名称',
            field:'labName',
            width:60,
            sortable:true,
            align:'center',
            halign:'center',
        },
        {
            title:'所属学院',
            field:'academy',
            sortable:true,
            width:100,
            align:'center',
            halign:'center',
        },
        {
            title:'分类',
            field:'category',
            width:100,
            align:'center',
            halign:'center',
        },
        {
            title:'创建日期',
            field:'createTime',
            align:'center',
            halign:'center',
            width:100,
            sortable:true,

        },
        {
            title:'创建人',
            field:'createrName',
            width:100,
            align:'center',
            halign:'center',
        },
        {
            title:'操作',
            field:'opt',
            width:100,
            align:'center',
            halign:'center',
            formatter: function(value,row,index){
                return "<a href='#'>编辑</a>";
            }
        }],
        onDblClickRow:function(){
            $('#table').datagrid('uncheckAll');
        }
    });

后台JSON返回值:(没有回车)
{"total":3,"rows":[{"createTime":"2016-05-12 17:01:30.000000","labName":"物理实验室","id":1,"category":"物
理类","academy":"理学院","createrName":"sysadmin"},{"createTime":"2016-05-12 17:01:37.000000","labName":"
化学实验室","id":2,"category":"化学类","academy":"理学院","createrName":"sysadmin"},{"createTime":"2016-05-12 17
:01:40.000000","labName":"金工实习","id":3,"category":"车床打磨","academy":"主校区","createrName":"sysadmin"}]}

报错:
图片说明

搞了一晚上了,以前做过类似的,返回的json都是一个格式,这回咋就不行了呢

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • danielinbiti danielinbiti 5年前
     columns定义
     columns:[[
        {field:'itemid',title:'Item ID',rowspan:2,width:80,sortable:true},
        {field:'productid',title:'Product ID',rowspan:2,width:80,sortable:true},
        {title:'Item Details',colspan:4}
    ]]
    
    点赞 评论 复制链接分享
  • nickzhou99 nickzhou99 5年前

    下午本来用的是jquery dataTable的,弄了一下午也是绑定不到数据。网上大大小小的教程都看了个遍,还是没改通。最后改换以前做过的easyui,结果也出现了奇怪的问题

    点赞 评论 复制链接分享