You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have model Huyet and Nhomuyet. Huyet has a property gorup_ids which store the ids of the Nhomuyet. (mean group of Huyet).
When I add a new Huyet or edit a Huyet, the window displays the checkbox with the 'ten' of Nhom huyet as expected. But when listing Huyet, Nhom huyet shown as open and close square bracket [] (if i use CheckboxRelationActiveQuery), or as [{"value":2,"label":"Block"},{"value":1,"label":"Heatting"}]. (if i use sortRelationModel).
So, how to display 'ten' of Nhomhuyet is display, more effective i can click to show the Nhomhuyet?
public function ngRestAttributeTypes()
{
return [
////using sortRelationModel
// 'group_ids' => [
// 'sortRelationModel',
// 'modelClass' => Nhomhuyet::className(),
// 'valueField' => 'id',
// 'labelField' => 'ten'
// ],
////using CheckboxRelationActiveQuery
'group_ids' => [
'class' => CheckboxRelationActiveQuery::class,
'query' => $this->getGroups(),
'labelField' => ['ten'],
],
'hinh' => 'image',
'ten' => 'text',
];
}
public function getGroups()
{
return $this->hasMany(Nhomhuyet::class, ['id' => 'nhomhuyet_id'])->viaTable(HuyetToNhom::tableName(), ['huyet_id' => 'id']);
}
The text was updated successfully, but these errors were encountered:
I have model Huyet and Nhomuyet. Huyet has a property gorup_ids which store the ids of the Nhomuyet. (mean group of Huyet).
When I add a new Huyet or edit a Huyet, the window displays the checkbox with the 'ten' of Nhom huyet as expected. But when listing Huyet, Nhom huyet shown as open and close square bracket [] (if i use CheckboxRelationActiveQuery), or as [{"value":2,"label":"Block"},{"value":1,"label":"Heatting"}]. (if i use sortRelationModel).
So, how to display 'ten' of Nhomhuyet is display, more effective i can click to show the Nhomhuyet?
public function ngRestAttributeTypes()
{
return [
////using sortRelationModel
// 'group_ids' => [
// 'sortRelationModel',
// 'modelClass' => Nhomhuyet::className(),
// 'valueField' => 'id',
// 'labelField' => 'ten'
// ],
////using CheckboxRelationActiveQuery
'group_ids' => [
'class' => CheckboxRelationActiveQuery::class,
'query' => $this->getGroups(),
'labelField' => ['ten'],
],
'hinh' => 'image',
'ten' => 'text',
];
}
public function getGroups()
{
return $this->hasMany(Nhomhuyet::class, ['id' => 'nhomhuyet_id'])->viaTable(HuyetToNhom::tableName(), ['huyet_id' => 'id']);
}
The text was updated successfully, but these errors were encountered: