JS
//初始化列表
function InitGrid() {
//绑定数据表
$('#dgMain').datagrid({
fit: true,
singleSelect: false,
collapsible: true,
method: 'post',
pageList: [50, 100, 150, 200],
pageSize: 50,
pagination: true,
idField: 'id',
toolbar: "#tbMain",
autoRowHeight: false,
rownumbers: true,
multiSort: true,
border: false,
onLoadSuccess: dgModuleButton,
});
LoadGrid();
}
//加载列表
function LoadGrid() {
//获取查询条件
var queryParams = GetQueryParams();
//加载数据
var options = $('#dgMain').datagrid('options');
options.url = 'data_Handler.ashx?method=getData';
options.method = 'post';
$('#dgMain').datagrid('load', queryParams);
}
//初始化按钮
function dgModuleButton(data) {
//在列表下面增加左右滑动的滑块
$('#dgMain').datagrid('resize', {
height: 600,
width: 800
});
}
HTML
<table id="dgMain">
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"></th>
<th data-options="field:'id',">编号</th>
<th data-options="field:'name',">名称</th>
<th data-options="field:'date',formatter:DateFieldFormatter,sortable:true">日期</th>
<th data-options="field:'age',">年龄</th>
</tr>
</thead>
</table>
工作中碰到的,记录一下
代码有省略