1.首先格式化表格 formatter: operateFormatter
{field : "operate", title : "操作", align: "center",events: "operateEvents", width : "100px", formatter: operateFormatter}
2.表格中增加按钮
function operateFormatter(value, row, index) {
return [
'<button type="button" class="RoleOfEdit btn btn-default btn-sm" style="margin-right:15px;">编辑</button>'
].join('');
}
3.按钮点击事件
window.operateEvents = {
'click .RoleOfEdit': function (e, value, row, index) {
alert("D");
}
};