1.grid
//禁用创建按钮
$grid->disableCreateButton();
//禁用导出数据按钮
$grid->disableExport();
//禁用列选择器
$grid->disableColumnSelector();
//不显示操作里的查看和修改
$grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->disableEdit();
$actions->disableView();
});
//添加自定义按钮
$grid->tools(function ($tools) {
$tools->append('<a href="#" class="btn btn-sm btn-info" ><i class="glyphicon glyphicon-open"></i>提交</a>');
});
//去掉批量删除按钮
$grid->tools(function ($tools) {
$tools->batch(function ($batch) {
$batch->disableDelete();
});
});
2.show
$show->panel()->tools(function ($tools) {
// 禁用编辑
$tools->disableEdit();
// 禁用列表
$tools->disableList();
// 禁用删除
$tools->disableDelete();
}
3.form
$form->tools(function (Form\Tools $tools) {
// 去掉`列表`按钮
$tools->disableList();
// 去掉`删除`按钮
$tools->disableDelete();
// 去掉`查看`按钮
$tools->disableView();
// 添加一个按钮, 参数可以是字符串, 或者实现了Renderable或Htmlable接口的对象实例
$tools->add('<a class="btn btn-sm btn-danger"><i class="fa fa-trash"></i> delete</a>');
});
//表单底部
$form->disableReset();
$form->disableEditingCheck();
$form->disableViewCheck();
来源:oschina
链接:https://my.oschina.net/u/4333555/blog/4300881