Difference between #7 and #8 of
Relational data fields display and edit with the yii2-detail-view extension

Changes

Title unchanged

Relational data fields display and edit with the yii2-detail-view extension

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

yii2, detail, detail-view, yii2-detail-view, DetailView, kartik, kartik-v, relational, attribute, relation, invalid, property, string, array, view, edit

Content changed

[...]
'data'=>ArrayHelper::map(Author::find()->orderBy('name')->asArray()->all(), 'id', 'name'),
]
]
```

Now that should resolve both the VIEW and EDIT issues for you. With the above configuration, users would still see the author `name` instead of `author_id` in both VIEW and EDIT modes. In the EDIT mode, the above configuration will
internally use the `author_id` to save data, but display the author names as a dropdown list using the `\kartik\widgets\Select2` widget.
4 0
41 followers
Viewed: 63 631 times
Version: 2.0
Category: Tutorials
Written by: Kartik V
Last updated by: Kartik V
Created on: May 30, 2014
Last updated: 9 years ago
Update Article

Revisions

View all history