ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
:-: **给table添加一列** > addColumn table中最重要的方法 * * * * * 源代码 ~~~ /** * @title 添加一列 * @description 添加一列 * @createtime: 2018/7/13 19:20 * @param string $field 对应的返回data中的字段 true '' '' * @param string $title 对应的上方显示的title true '' '' * @param bool $sort 是否可以排列,排列提交到服务端进行 false false true|false * @param array $config 其他配置参考,会自动带入到cols中 false [] '' * @return $this */ public function addColumn($field, $title, $sort = false, $config = []){ $config = array_merge([ 'field' => $field, 'title' => $title, 'sort' => $sort, 'width' => '', 'type' => 'normal',//checkbox, space,numbers 'LAY_CHECKED' => 'false', 'fixed' => '', 'unresize' => 'false', 'edit' => '', 'event' => '', 'styles' => '', 'align' => '', 'colspan' => '', 'rowspan' => '', 'templet' => '', 'toolbar' => '' ], $config); $this->columns[] = array_filter($config); return $this; } ~~~ * * * * * 使用方法 ~~~ $table->addColumn("ispass", "审核状态", false, [ 'width' => 100, 'align' => "center", ‘templet’ => "",//使用的模板, 需要看下方的addTemplate 'toolbar' => "#manageStatus-template"//和addTemplate的id相对应 'minWidth' => ""//最小宽度 'fixed' => ""//left或right固定在左右 'unresize' => false//是否可以拖拽列 'event' => ""//事件名称 'style' => ""//单元格样式 'align' => ""//单元格排列样式,left|center|right ]) ~~~ 其他使用方式参考 [Layui的Table](http://www.layui.com/doc/modules/table.html)