When we use bootstrapTable, we sometimes need to hide a column according to conditions, such as permissions
{ field : 'id', title : 'Operation', width : 80, align : 'center', formatter : function(value, row, index) { var operation = ""; // approve 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(){ //Execute when the load is successful if($.string.isNullOrWhiteSpace($("#btn_approval").val())){ $('#tb_org').bootstrapTable('hideColumn', 'id'); } }
onLoadSuccess : function(){ //Execute when the load is successful
if($.string.isNullOrWhiteSpace($("#btn_approval").val())){
$('#tb_org').bootstrapTable('hideColumn', 'id');
}
}
id is the field value of that column