>[danger] 友情提示:构建器目前只支持HisiPHP Pro版本([我要升级](https://www.hisiphp.com/authorize.html))
表格页面在后台管理开发中,使用频率最高,主要用于数据的展示和管理。
## 如何使用
HisiPHP内置的表格构建器同表单构建器一样的简单,无需引入任何类库,与TP的模板赋值方法一样赋值即可,页面渲染方法与TP完全一致。下面提供一段示例代码,在后面的章节会针对不同的配置项做具体说明:
```
// 表格构建器示例
public function table()
{
$assign = [];
$assign['buildTable'] = [
'toolbar' => [
[
'title' => '添加',
'url' => url('add'),
'class' => 'hisi-iframe',
'data' => [
'title' => '添加内容',
],
],
[
'title' => '删除',
'url' => url('del'),
'class' => 'hisi-toolbar-btn layui-btn-normal',
],
],
'filter' => [
'items' => [
[
'type' => 'text',
'title' => '客户名',
'name' => 'title',
],
[
'type' => 'date',
'title' => '日期',
'name' => 'date',
],
[
'type' => 'select',
'title' => '城市',
'name' => 'select',
'option' => [
1 => '北京',
2 => '上海',
3 => '重庆',
],
],
],
],
'config' => [
'page' => true,
'limit' => 20,
'cols' => [
[
'type' => 'checkbox',
],
[
'field' => 'id',
'title' => 'ID',
'width' => 100,
],
[
'field' => 'title',
'title' => '客户名',
'width' => 200,
],
[
'field' => 'area',
'title' => '城市',
'width' => 200,
],
[
'field' => 'create_time',
'title' => '创建时间',
'width' => 200,
],
[
'title' => '操作',
'templet' => '
',],
],
],
];
// 模板赋值并渲染
return $this->assign($assign)->fetch();
}
```
渲染结果如下:
![](https://box.kancloud.cn/e24a61a4a561f07040644870f068bf32_2872x1050.jpg)