Prabuddha Namal
Prabuddha Namal

Reputation: 19

Display dropdownlist filter data?

<?= $form->field($model, 'SRF_STUDENT_ID')->dropdownList(
                    ArrayHelper::map(StudentDetails::find()->all(),'STUDENT_REGISTRATION_ID','STUDENT_REGISTRATION_ID'),
                    ['prompt'=>'Select Student Id']); ?>

how to set where condition in the dropdownlist. i want select STUDENT_REGISTRATION_ID from StudentDetails where is_select = 0; data result set dropdownlist. please give me your help.

Upvotes: 1

Views: 68

Answers (1)

Insane Skull
Insane Skull

Reputation: 9358

Try this:

<?= $form->field($model, 'SRF_STUDENT_ID')->dropdownList(
                 ArrayHelper::map(StudentDetails::find()->where(['is_select' => 0])->all(),'STUDENT_REGISTRATION_ID','STUDENT_REGISTRATION_ID'),
                ['prompt'=>'Select Student Id']); ?>

Upvotes: 1

Related Questions