Hauke29
(Hauke29)
1
Hi all,
my dropDownList with data from the related parent table works, but it’s sorted by id, not by the attribute name.
<?= $form->field($model, 'parent_id')->dropDownList(ArrayHelper::map(parenttable::find()->all(), 'id', 'name')) ?>
How to sort this by name?
evstevemd
(Stefano Mtangoo)
2
ModelClass::find()->orderBy("name DESC")->all()
read the docs before asking
Hauke29
(Hauke29)
3
Thanks. I read the docs but couldn’t find it. Searched in the wrong class. Sorry for asking.