- buttons按钮的隐藏
通过 hidden: true/false 控制显示或者隐藏
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [[{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [name: '提交', text: __('提交'), icon: 'fa fa-reorder', url: 'user/deal/add', hidden: function(row) {
if (row === 1) {
return false;
} else {
return true;
}
}],
formatter: Table.api.formatter.operate,
}]]
});
- 整个buttons字段的隐藏
通过 formatter: 回调方法实现
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [[
{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
formatter: function(value, row, index) {
var that = $.extend({}, this);
if (row.status === 2) {
return '';
}
return Table.api.formatter.operate.call(that, value, row, index);
}
}
]]
});
- 普通字段隐藏
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [[
{
field: 'c.shop_id',
title: (is_status) ? '' : '店铺名称',
operate: 'LIKE',
searchList: $.getJSON("members/shop"),
visible:(is_status) ? '' : true,
},
]]
});
查看更多