第一种:
{
label: '操作', name: 'Operate', width: 80, align: 'center', edittype:"button", formatter:function(cellvalue, options, rowObject){
return "<button class='btn btn-danger' style='padding:3px 12px;' data-rowid='"+ options.rowId +"' οnclick='DelFile("+ options.rowId + ");'>删除</button>";
}
}
//事件
function DelFile(id){
alert(id)
}
第二种:
{ label: '操作', name: 'Operate', width: 80, align: 'center', edittype:"button", formatter:formatModel }
//事件
function formatModel(cellValue, options, rowObject) {
var imageHtml = "<button class='btn btn-danger' style='padding:3px 12px;' data-rowid='"+ options.rowId +"' οnclick='DelFile("+ options.rowId + ");'>删除</button>";
return imageHtml;
}
function DelFile(id){
alert(id)
}