$i) { $arr_keys[] = "attr_{$i}"; $i++; } array_flip($arr_keys); } $model = new DynamicModel($arr_keys); return $model; } // @todo add comments public static function CreateGridWithDropDownListHeader( $dataProvider, $form, $header_model, $arr_header_values ) { $columns_config = [['class' => SerialColumn::className()]]; $i = 0; foreach( $header_model as $key => $value ) { $columns_config[] = ['header' => $form->field($header_model, $key, ['inputOptions' => ['label' => '']])->dropDownList($arr_header_values), 'attribute' => $i]; $i++; } $dynamic_grid_view = GridView::widget( ['dataProvider' => $dataProvider, 'columns' => $columns_config ] ); return $dynamic_grid_view; } }