Yii2 dropwdown list filter in GridView


/ Published in: PHP
Save to your folder(s)

Put it in the columns array


Copy this code and paste it in your HTML
  1. [
  2. 'attribute' => 'attribute_name',
  3. 'value' => 'attribute_value',
  4. 'filter' => Html::activeDropDownList($searchModel, 'attribute_name', ArrayHelper::map(ModelName::find()->asArray()->all(), 'ID', 'Name'),['class'=>'form-control','prompt' => 'Select Category']),
  5. ],

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.