F.ui({
type: 'grid', id: 'grid1', renderTo: '#wrap1', width: 700, collapsible: true, title: '表格',
//sorting: true,//排序
//databaseSorting: true,
//sortField: "djxh",
//sortDirection: "DESC",
paging: true, //是否启用分页
databasePaging: true, //是否数据库分页
pageSize: 5, //每页显示记录数
//summary: false, //显示合计行
columnMoving: true, //是否启用列移动
idField: 'id',
textField: 'name',
fields: ["djxh", "dh", "djlx", "khbh", "khmc"],
columns: [
{columnType: 'rownumberfield'}, //序号
{text: '单据型号', field: 'djxh', width: 100},
{text: '单号', field: 'dh', width: 150},
{text: '单据类型', field: 'djlx', width: 100},
{text: '客户编号', field: 'khbh', width: 100},
{text: '客户名称', field: 'khmc', width: 200}
],
//data: DATA,
//dataUrl: "/findAllWpdj", //网址数据源
//dataMethod: "POST", //请求网址数据源的方法
listeners: {
paging: function (event, pageIndex) {
//console.log(event);
this.setPageIndex(pageIndex); //设置新的分页索引
this.loadData(getPageWpdj(parseInt(pageIndex) + 1)); //加载数据
//this.setRecordCount(getRecordCount());
},
sorting: function(event,sortField,sortDirection,columnId){
console.log(sortField);
console.log(sortDirection);
console.log(columnId);
}
},
});
var grid1 = F.ui.grid1;
grid1.setRecordCount(getRecordCount()); //设置总记录数
//grid1.setSortField("djxh","DESC");
grid1.loadData(getPageWpdj(1)); |