bootstraptable表头字段排序
var col = [{
field: 'checked',
checkbox: true,
align: 'center'
}, {
field: 'id',
title: 'id',
align: 'center'
}, {
field: 'PROJECT_NAME',
title: '项⽬名称',
align: 'center'
}, {
field: 'CONTRACT_DATE',
title: '合同签订⽇期',
align: 'center'
}, {
field: 'WORKLOAD',
title: '⼯作量(⼈天)',
align: 'center'
}, {
field: 'TOTAL_AMOUNT',
title: '项⽬⾦额',
align: 'center'
}, {
field: 'PAY_AMOUNT',
title: '已收⾦额',
class: 'aa',
formatter: function (value, row, index) {
if(value>=row.TOTAL_AMOUNT&&row.TOTAL_AMOUNT>0){
return "<img src='#(ctx)/common/img/over2.png' style='width: 50px;height: 100%'/>";
}else{
return value;
}
},
align: 'center'
}, {
field: 'LASTMODIFIEDDATETIME',
title: '更新⽇期',
sortable:true,
align: 'center'
}, {
field: 'control',
title: '操作',
align: 'center',
formatter: function (value, row, index) {
//通过formatter可以⾃定义列显⽰的内容
var a='';
if (!(row.PAY_AMOUNT >= row.TOTAL_AMOUNT && row.TOTAL_AMOUNT > 0)) {//未结款加载按钮
a = a + '#if(shiro.hasPermission("admin:project:fee"))<a class="label label-table label-info" οnclick="changeFee(' + row.id + ',' +
row.TOTAL_AMOUNT + ')" href="javascript:void(0);" >收款</a> #end';
a = a + '#if(shiro.hasPermission("admin:demand:update"))<a class="label label-table label-success" οnclick="doPjax(\'' + ctx +
'/demandManage/makeContract?id=' + row.id + '\')" href="javascript:void(0);" >编辑</a> #end';
}
a = a + '#if(shiro.hasPermission("admin:project:delete"))<a class="label label-table label-danger" οnclick="del(\'' + row.id + '\')"
href="javascript:void(0);" >删除</a> #end';
a = a + '#if(shiro.hasPermission("admin:project:view"))<a class="label label-table label-mint" οnclick="doPjax(\'' + ctx + '/project/view?id=' + row.id + '\')" href="javascript:void(0);" >查看</a> #end';
a = a + '#if(shiro.hasPermission("admin:project:flolo"))<a class="label label-table label-mint" οnclick="doPjax(\'' + ctx + '/project/follow?id=' + row.id + '\')" href="javascript:void(0);" >跟进</a> #end';
return a;
}
}];
}];
var opt = {
//请求⽅法
method: 'get',
//是否显⽰⾏间隔⾊
striped: true,
//是否使⽤缓存,默认为true,所以⼀般情况下需要设置⼀下这个属性(*)cache: false,
//data-toolbar: "#demo-delete-row",
//是否显⽰分页(*)
pagination: true,
//是否启⽤排序
sortable: true,
/
/排序⽅式
sortOrder: "desc",//排序
sortName: 'LASTMODIFIEDDATETIME',//排序字段
//初始化加载第⼀页,默认第⼀页
//我设置了这⼀项,但是貌似没起作⽤,⽽且我这默认是0,- -
//pageNumber:1,
//每页的记录⾏数(*)
pageSize: 5,
//可供选择的每页的⾏数(*)
pageList: [5, 10, 20, 50],
bootstrap项目//这个接⼝需要处理bootstrap table传递的固定参数,并返回特定格式的json数据url: ctx + "/project/listData",
//默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else queryParamsType: '',
//分页⽅式:client客户端分页,server服务端分页(*)sidePagination: "server",
//是否显⽰搜索
search: true,
//Enable the strict search.
strictSearch: true,
//Indicate which field is an identity field.
idField: "id",
columns: col,
pagination: true
};
/
/表格
function initTable() {
$('#projectTable').bootstrapTable(opt);
$('#projectTable').bootstrapTable('hideColumn', 'id');
}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论