我一直在尝试使用jquery-easyui datagrid来自http://www.jeasyui.com/documentation/index.php的。文档声明网格将接受 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"
     }
     ]
}
我的html看起来像这样......
 <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 文件的引用都是正确的。网格在浏览器中渲染得很好。所有的按钮都在那里,我什至有正确的行数……只是单元格中没有数据。