-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using CheckboxRelationActiveQuery and sortRelationModel can add data but not displayed on listing #257
Comments
Checkbox relations currently does not support list of relation data in the NgRest LIST - this is because there can be 100 of items and those: a. slow down dramatically the list But of course for small relation behavior, it should be able to display this data. Thanks for creating |
Can we define or default a number max to display? I think it is better than display nothing or display json. |
Maybe we could at least display the number of relation items? like a count |
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: