datagrid例子如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic DataGrid - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<script type="text/javascript">
//页面加载
$(function() {
$('#tt').datagrid("loadData", [ {
itemid : 0,
productid : 123,
listprice : "123",
unitcost : 123,
attr1: "ada",
status : "123"
} ]);
$('#tt').datagrid({ pagination:true,
rownumbers:true
});
$('#tt').datagrid('getPager').pagination({beforePageText : '第',
afterPageText : '页 共 {pages} 页',displayMsg:'当前显示从{from}到{to}共{total}记录'});
});
</script>
<body>
<h2>Basic DataGrid</h2>
<p>The DataGrid is created from markup, no JavaScript code needed.</p>
<div style="margin:20px 0;"></div>
<table id="tt" class="easyui-datagrid" title="Basic DataGrid" style="width:700px;height:250px"
>
<thead>
<tr>
<th data-options="field:'itemid',width:80">Item ID</th>
<th data-options="field:'productid',width:100">Product</th>
<th data-options="field:'listprice',width:80,align:'right'">List Price</th>
<th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
<th data-options="field:'attr1',width:250">Attribute</th>
<th data-options="field:'status',width:60,align:'center'">Status</th>
</tr>
</thead>
</table>
</body>
</html>
如果要展示数据库提成的数据 只要把loadData后的数组改成 后台返回的json就行 |