> 顾名思义:构建表格的最小配置项
1. `columns` 定义表格列字段和其他选项
2. `query` 定义表格数据查询的`闭包` 该闭包需要返回`yii\db\Query`对象
如图:
![](https://img.kancloud.cn/fb/eb/fbeb393f7fad58a3c8a8f5a83fd7c2ce_1062x844.png)
代码如下:
~~~
return ViewBuilder::table([
'columns' => [
'username' => table_column_helper('用户名', ['style' => ['min-width' => '100px']]),
'email' => table_column_helper('邮箱', ['style' => ['min-width' => '200px']]),
],
'query' => function () {
$query = AdminUser::find()->select(['id', 'username', 'email']);
return $query;
},
])->render($this);
~~~