引用easyui
- <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-1.7.2.min.js"></script>
- <script type="text/javascript" src="../jquery.easyui.min.js"></script>
javascript代码
- $(function(){
- $('#tt').datagrid({
- url:'datagrid_data2.json',
- columns:[[
- { field:'productid',
- title:'Product ID',
- width:120
-
-
-
-
-
-
-
-
-
-
-
-
- },
-
- {field:'listprice',title:'List Price',width:80,align:'right'},
- {field:'unitcost',title:'Unit Cost',width:80,align:'right'},
- {field:'attr1',title:'Attribute',width:250},
- {field:'status',title:'Status',width:60,align:'center'}
- ]],
- frozenColumns:[[
- {field:'ck',checkbox:true},
- {field:'itemid',title:'Item ID',width:80,sortable:true}
- ]],
-
-
- toolbar:[{
- iconCls: 'icon-edit',
- text:'编辑',
- handler: function(){alert('edit')}
- },'-',{
- iconCls: 'icon-help',
- text:'帮助',
- handler: function(){alert('help')}
- }],
-
-
-
-
- loadMsg:'请稍候...',
- pagination:true,
- rownumbers:true,
- singleSelect:true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- });
-
- $('#tt').datagrid('getPager').pagination({
- pageSize: 10,
- pageList: [5,10,15],
- beforePageText: '第',
- afterPageText: '页 共 {pages} 页',
- displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录'
-
-
-
-
-
- });
- });
html代码
- <table id="tt"></table>