我们在用bootstrapTable的时候,有时需要根据条件,比如权限隐藏某一列
{ field : 'id', title : '操作', width : 80, align : 'center', formatter : function(value, row, index) { var operation = ""; // 审批 if (!$.string.isNullOrWhiteSpace($( "#btn_approval").val())) { operation += "<a href='javascript:void(0);' id='approval'>审核</a>"; } return operation; }, events: { 'click #approval' : function (e, value, row, index) { toEncodeUrlPage(mw.ctx+ "/sbas/org/manageDetail?id="+row.orgId+ "&userId="+row.id); } } }], onLoadSuccess: function(){ //加载成功时执行 if($.string.isNullOrWhiteSpace($("#btn_approval").val())){ $('#tb_org').bootstrapTable('hideColumn', 'id'); } }
onLoadSuccess : function(){ //加载成功时执行
if($.string.isNullOrWhiteSpace($("#btn_approval").val())){
$('#tb_org').bootstrapTable('hideColumn', 'id');
}
}
id 就是那一列的field值