样式:备注与创建人数据库中有数据,但无法显示
![](https://img-blog.csdnimg.cn/img_convert/fda4c6b3ade7ae2e965ea0ce0d251a4a.png)
![](https://img-blog.csdnimg.cn/img_convert/1982ee9d0e0f49b83b96b62d28fed071.png)
分析:
①检查js中拼写是否出错,需要与数据库对应
{field: 'remark', title: __('Remark'), operate: 'LIKE'},
{field: 'created_by', title: __('Created_by'), operate: 'LIKE'},
②检查控制器是否存在数据的限制
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = false;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->visible(['id','pr_num','status','need_time','approve_by','approve_time','createtime','depart_name','order_type']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
可见,在控制器中,限制了显示的字段,只要如下的信息可以展示
$row->visible(['id','pr_num','status','need_time','approve_by','approve_time','createtime','depart_name','order_type']);
解决办法:
向可见字段中加入'remark','created_by'
结果:
![](https://img-blog.csdnimg.cn/img_convert/6df4e8048bd07ce059632844ff8e99d4.png)