2amigos / yii2-selectize-widget

Selectize From Brian Reavis Yii2 Widget
Other
73 stars 41 forks source link

On Update, form is not pre populated with selection #26

Closed katag9k closed 8 years ago

katag9k commented 8 years ago
<?php
$model->category_id = 7;
echo $form->field( $model, 'category_id' )->widget( SelectizeDropDownList::className(), [
    'clientOptions' => [
        'persist'     => false,
        'create'      => true,
        'options'     => Category::getOptionArray(),
        'valueField'  => 'id',
        'labelField'  => 'category',
        'searchField' => [ 'category' ],
        'maxItems'    => 1,
    ],
] );
?>

When updating, the form is not pre-populated with the correct category. screen shot 2016-05-26 at 4 52 13 pm

tonydspaniard commented 8 years ago

You need to set the 'items' attribute

katag9k commented 8 years ago

Of course... Thank you