繁体   English   中英

杂货杂货隐藏字段和设置关系无法一起使用

[英]Grocery crud hidden field and set relation didnt work together

我对杂货杂货隐藏字段和设置关系有疑问。

我的代码是

$crud->set_relation('created_by','users','user_name'); 
$crud->edit_fields('title', 'description', 'created_by');
$crud->change_field_type('created_by', 'hidden', $this->user_id);

在这里,我要存储以隐藏形式创建的user_id。 但是问题是在我的视图页面中created_by字段仍然可见。 当我切断set_relation时,created_by字段被隐藏。 什么问题 ? 请帮我

$state = $crud->getState();
if ($state === 'list') {
  $crud->set_relation('created_by','users','user_name'); 
}
$crud->edit_fields('title', 'description', 'created_by');
$crud->change_field_type('created_by', 'hidden', $this->user_id);

使用下面的编码

$crud->change_field_type('created_by', 'hidden', $this->user_id);

$crud->field_type('created_by', 'hidden', $this->user_id);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM