Code directly
public function tryui(){
$grid = new Grid(new AdminTest());
//设置字段
$grid->column('id', 'id')->width(80);
$grid->column('test', 'test')->width(80);
$grid->column('test1', 'test1')->width(80);
$grid->column('test2', 'test2')->width(80);
$grid->dataUrl("/index/tryui");
//toolbar设置
$grid->toolbars(function (Grid\Toolbars $toolbars) {
$toolbars->createButton()->content("添加新");
});
//action设置
$grid->actions(function (Grid\Actions $actions) {
$actions->editAction()->requestMethod("put");
$key = $actions->getRow()["id"];
$actions->add(Grid\Actions\ActionButton::make("操作:$key")->handler(Grid\Actions\ActionButton::HANDLER_ROUTE)->uri("index/tryui_create/".$key));
});
return $grid;
}
This framework follows the restful interface mode. You can set the delete or modify button request method, or directly add an operation to bind to the specified connection.