### 配置項`toolbarExport`
> 配置工具欄導出按鈕
#### 參數`arrau $options 選項`
> -`title string 按鈕名稱,默認:`
> -`icon string 按鈕圖標,默認: glyphicon glyphicon-export`
> -`heads 自定義頭部`
* ['ID', '用戶名', '郵箱', '電話']
> -`fields 自定義字段; 如果沒定義則使用列表字段`
* ['id', 'username', 'email', 'an', 'mobile']
> -`columns 自定義列`
~~~
[
'id',
'username',
'email',
'mobile' => function ($item) {
return '+' . $item['an'] . ' ' . $item['mobile'];
},
],
~~~
示例代碼:
~~~
return ViewBuilder::table()
->setTitle('會員列表')
->setPage(true)
->setHideCheckbox(false)
->setToolbarRefresh()
->setToolbarExport([
'icon' => '',
'name' => '會員列表',
'heads' => ['ID', '用戶名', '郵箱', '電話'],
'fields' => ['id', 'username', 'email', 'an', 'mobile'],
'columns' => [
'id',
'username',
'email',
'mobile' => function ($item) {
return '+' . $item['an'] . ' ' . $item['mobile'];
},
],
])
->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', 'status']);
return $query;
})
->setOrderBy('id DESC')
->setPrimaryKey('id')
->render($this);
~~~
示例圖示:


