[英]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.