1.进入对应目录:eg(public/assets/js/backend/conmpany.js)
2.在field:'operate' 中添加buttons
源码:
{field: 'operate', title: __('Operate'), table: table,
buttons: [
{
name: 'detail',
text: __('企业产品管理'),
title: __('企业产品管理'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=\'["80%", "80%"]\'',
url: 'company_goods?company_id={ids}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
}
], events: Table.api.events.operate, formatter: Table.api.formatter.operate}
3.其中 extend: 'data-area=\'["80%", "80%"]\'', 为设置点击后弹出页面的大小