用JSON文本动态创建DataGrid
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>表格</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!-- 引入css文件,无顺序 --> <link rel="stylesheet" href="themes/icon.css" type="text/css"></link> <link rel="stylesheet" href="themes/default/easyui.css" type="text/css"></link> <!-- 引入js文件,有顺序 --> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.easyui.min.js"></script> </head> <body> <table border="2" align="center" class="easyui-datagrid"> <thead> <tr> <th data-options="field:'id'">编号</th> <th data-options="field:'name'">姓名</th> <th data-options="field:'sal'">薪水</th> <th data-options="field:'sex'">性别</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>哈哈</td> <td>6000</td> <td>男</td> </tr> <tr> <td>2</td> <td>呵呵</td> <td>7000</td> <td>男</td> </tr> <tr> <td>3</td> <td>嘻嘻</td> <td>8000</td> <td>女</td> </tr> </tbody> </table> </body> </html>
最后,关注【码上加油站】微信公众号后,有疑惑有问题想加油的小伙伴可以码上加入社群,让我们一起码上加油吧!!!