$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
// data:reet.data,
url:'../data/yonghuguanli.json',
// uniqueId: "SOBID",
striped:true,
pagination:true,
clickToSelect:true,
height:580,
columns: [{
checkbox:true,
},{
field: 'id',
sortable:true,
title: '组织编码',
sortable: true,
},{
field: 'name',
title: '组织名称',
sortable: true,
},{
field: 'lexing',
title: '账套编号',
sortable: true
},{
field: 'zt',
title: '账套名称',
sortable: true
}, {
field: 'operate',
title: '操作',
align: 'center',
events: "operateEvents",
formatter: operateFormatter
}],
});
2:表格中增加按钮
operateFormatter(value, row, index):这三个参数是bootsharp-table默认的
function operateFormatter(value, row, index) {
return [
'A权限',
'B权限',
'C权限',
'绑定D',
'编辑'
].join('');
}
3:注册按钮的点击事件
每个按钮对应哪个点击事件,是用Class里面的属性标识的,如上步骤2(比如:RoleOfA)
window.operateEvents = {
'click .RoleOfA': function (e, value, row, index) {
alert("A");
},
'click .RoleOfB': function (e, value, row, index) {
alert("B");
},
'click .RoleOfC': function (e, value, row, index) {
alert("C");
},
'click .RoleOfEdit': function (e, value, row, index) {
alert("D");
}
};
标签:index,行内,title,bootstrap,value,field,table,true,row
来源: https://blog.csdn.net/weixin_44018338/article/details/100043646