Jquery Easyui Datagrid作成コード
参照easyui
JAvascriptコード
htmlコード
- <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
- //rowspan:2
- //colspan:2
- //align:'center'
- //sortable:true
- //resizable:true
- //hidden:true
- //checkbox:true
- //formatter:function(value,row,index){}
- //styler:function(value,row,index){}
- //sorter:function(a,b){ }
- //editor:string,object
-
- },
-
- {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}
- ]],
- //fitColumns:false,//true
- //autoRowHeight:true,
- toolbar:[{
- iconCls: 'icon-edit',
- text:' ',
- handler: function(){alert('edit')}
- },'-',{
- iconCls: 'icon-help',
- text:' ',
- handler: function(){alert('help')}
- }],
- //striped:true,// ,
- //method:'post',
- //nowrap:true,//false
- //idField:'itemid',
- loadMsg:' ...',
- pagination:true,//
- rownumbers:true,//
- singleSelect:true
- //checkOnSelect:true,
- //selectOnCheck:true,
- //pagePosition:'both',
- //pageNumber:1,
- //pageSize:10,
- //pageList:[10,20,30,40,50],
- //queryParams: {
- // name: 'easyui',
- // subject: 'datagrid'
- //},
- //sortName:'itemid',
- //sortOrder:'desc',
- //remoteSort:false,//true ,false
- //showHeader:true,
- //showFooter:true,
- //scrollbarSize:18,
- //rowStyler:function(index,row,css){}
- //loader:'json loader',
- //loadFilter:function(data){}
- //editors:'predefined editors',
- //view:'default view'
- });
- //
- $('#tt').datagrid('getPager').pagination({
- pageSize: 10,// , 10
- pageList: [5,10,15],//
- beforePageText: ' ',//
- afterPageText: ' {pages} ',
- displayMsg: ' {from} - {to} {total} '
- /*onBeforeRefresh:function(){
- $(this).pagination('loading');
- alert('before refresh');
- $(this).pagination('loaded');
- }*/
- });
- });
htmlコード
- <table id="tt"></table>