### 配置项`query`
> 数据列的数据
参数
1. `\Closure $query`
> 值:返回`yii\db\Query`对象的闭包函数
示例代码:
~~~
return ViewBuilder::table()
->setPage(true)
->setHideCheckbox(false)
->setColumns([
'password',
'username' => table_column_helper('用户名', ['style' => ['min-width' => '100px']]),
'an_mobile' => table_column_helper('电话', ['style' => ['min-width' => '100px']], function($item){
return '+' . $item['an'] . ' ' . $item['mobile'];
}),
'email' => table_column_helper('邮箱', ['style' => ['min-width' => '200px']]),
])
->setQuery(function () {
$query = AdminUser::find()->select(['id', 'username', 'password', 'email', 'an', 'mobile']);
return $query;
})
->render($this);
~~~
示例图示:
![](https://img.kancloud.cn/7f/84/7f841583ac1ec29024f48d2d0db4e759_1691x839.png)