效果圖:javascript
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="../css/skins/Aqua/css/ligerui-all.css" />
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/ligerUi/ligerui.min.js"></script>
<script type="text/javascript" src="../js/ligerUi/ligerGrid.js"></script>
<script type="text/javascript">
//初始化數據
var jsonObj = {};
jsonObj.Rows= [
{ id: 1, name: "林三", sex: "男", birthday: "1989/01/12",score:63.3 },
{ id: 2, name: "陳麗", sex: "女", birthday: "1989/01/12", score: 72.2 },
{ id: 3, name: "啊羣", sex: "男", birthday: "1981/12/12", score: 43.4 },
{ id: 4, name: "表幫", sex: "男", birthday: "1983/01/12", score: 73.2 },
{ id: 5, name: "陳麗", sex: "女", birthday: "1989/01/12", score: 74.5 },
{ id: 6, name: "成錢", sex: "男", birthday: "1989/11/13", score: 73.3 },
{ id: 7, name: "都訊", sex: "女", birthday: "1989/04/2", score: 83.2 },
{ id: 8, name: "顧玩", sex: "男", birthday: "1999/05/5", score: 93.2 },
{ id: 9, name: "林會", sex: "男", birthday: "1969/02/2", score: 73.4 },
{ id: 10, name: "王開", sex: "男", birthday: "1989/01/2", score: 33.3 },
{ id: 11, name: "劉盈", sex: "女", birthday: "1989/04/2", score: 53.3 },
{ id: 12, name: "鄂韻", sex: "男", birthday: "1999/05/5", score: 43.5 },
{ id: 13, name: "林豪", sex: "男", birthday: "1969/02/21", score: 83.6 },
{ id: 14, name: "王開", sex: "男", birthday: "1989/01/2", score: 93.7 },
{ id: 15, name: "鄂酷", sex: "男", birthday: "1999/05/5", score: 61.1 },
{ id: 16, name: "林豪", sex: "男", birthday: "1969/02/21", score: 73.3 },
{ id: 17, name: "王開", sex: "男", birthday: "1989/01/2", score: 41.6 }
];
var columns =
[
{ display: '主鍵', name: 'id', type: 'int', mintWidth: 40, width: 100 },
{ display: '名字', name: 'name' },
{ display: '性別', name: 'sex' },
{ display: '生日', name: 'birthday', type: 'date' }
];
css
$(function() {
$("#maingrid").ligerGrid({
width:600,
columns:columns,
data:jsonObj,
usePager:true, //數據書否分頁,默認爲true
pageSize:"5",//分頁頁面大小
pageSizeOptions:[5,15,30]//可指定每頁頁面大小
});html
});
</script>
</head>java
<body>
<div id="maingrid"></div>
</body>jquery
</html>json