为什么jquery easyui网格不显示列数据?

为什么jquery easyui网格不显示列数据?,jquery,json,datagrid,jquery-easyui,Jquery,Json,Datagrid,Jquery Easyui,我一直在尝试使用来自的jquery easyui数据网格。文档声明网格将接受json数据,我已经尝试实现了这一点,但是这些列从未在网格中呈现 网格显示了正确的行数,每行都有一个行id,但忽略了所有其他数据。不知何故,网格正在读取json数据并知道正确的行数,但不会呈现列数据 我的json看起来像这样 {"total":2, "rows":[ {"id":"1", "name":"Employee One", "number":"1", "descr

我一直在尝试使用来自的
jquery easyui数据网格
。文档声明网格将接受json数据,我已经尝试实现了这一点,但是这些列从未在网格中呈现

网格显示了正确的行数,每行都有一个行id,但忽略了所有其他数据。不知何故,网格正在读取json数据并知道正确的行数,但不会呈现列数据

我的json看起来像这样

{"total":2,
 "rows":[
     {"id":"1",
      "name":"Employee One",
      "number":"1",
      "description":"This is the first Employee"
     },
     {"id":"2",
      "name":"Employee Two",
      "number":"2",
      "description":"This is the Second Employee"
     }
     ]
}
 <table id="dg" title="Surveys" class="easyui-datagrid" style="width:550px;height:250px"  
    url="listJson2"  
    toolbar="#toolbar"  
    rownumbers="true" fitColumns="true" singleSelect="true">  
  <thead>  
    <tr>  
        <th field="id" width="20">Id</th>  
        <th field="name" width="50">Name</th>  
        <th field="number" width="50">Number</th>  
        <th field="description" width="50">Description</th>  
    </tr>  
  </thead>  
 </table>
我的html看起来像这样

{"total":2,
 "rows":[
     {"id":"1",
      "name":"Employee One",
      "number":"1",
      "description":"This is the first Employee"
     },
     {"id":"2",
      "name":"Employee Two",
      "number":"2",
      "description":"This is the Second Employee"
     }
     ]
}
 <table id="dg" title="Surveys" class="easyui-datagrid" style="width:550px;height:250px"  
    url="listJson2"  
    toolbar="#toolbar"  
    rownumbers="true" fitColumns="true" singleSelect="true">  
  <thead>  
    <tr>  
        <th field="id" width="20">Id</th>  
        <th field="name" width="50">Name</th>  
        <th field="number" width="50">Number</th>  
        <th field="description" width="50">Description</th>  
    </tr>  
  </thead>  
 </table>

身份证件
名称
数
描述
我相信所有对js和css文件的引用都是正确的。网格在浏览器中渲染良好。所有的按钮都在那里,我甚至有正确的行数……只是单元格中没有数据。

试试loadData

var list=[
            {"id":"1",
                "name":"Employee One",
                "number":"1",
                "description":"This is the first Employee"
               },
               {"id":"2",
                "name":"Employee Two",
                "number":"2",
                "description":"This is the Second Employee"
               }
               ];

$('#dg').datagrid('loadData', list); 
试试loadData

var list=[
            {"id":"1",
                "name":"Employee One",
                "number":"1",
                "description":"This is the first Employee"
               },
               {"id":"2",
                "name":"Employee Two",
                "number":"2",
                "description":"This is the Second Employee"
               }
               ];

$('#dg').datagrid('loadData', list); 

我也遇到了同样的问题,我发现如果通过css将表的宽度默认设置为100%,那么它将不起作用


我知道这个问题有点老,但可能对其他人有帮助。

我也遇到了同样的问题,我发现如果通过css将表的宽度默认设置为100%,那么它将无法工作


我知道这个问题有点老,但可能对其他人有帮助。

我也面临着这个问题,如果你找到了,你能发布答案吗?我也面临着这个问题,如果你找到了,你能发布答案吗。