O
O
Oleg Aksenov2015-11-03 11:11:35
Yii
Oleg Aksenov, 2015-11-03 11:11:35

Using select2 with actions?

How to correctly implement the user's choice, for example, and pass it through the action specified in this select, so that the action is performed with it, for example, change the author.

[
                    'attribute'=> 'appointment',
                    'label'=>'Исполнитель',
                    'value'=>$model->appointment?$model->appointment->name: '',
                    'type'=>DetailView::INPUT_SELECT2,
                    'valueColOptions'=>['style'=>'wight:30%'],
                    'widgetOptions'=>[
                        'data'=>ArrayHelper::map(User::find()->orderBy('name')->where(['<>', 'role', 'user'])->asArray()->all(),
                        'id',
                        'name'
                        ),
                        'options'=>['placeholder'=>'Назначить на ...'],
                        'pluginOptions'=>[
                          'allowClear'=>true,
                        ],
                          'pluginEvents' => [
                              'change' => 'function(e){$(location).attr({href: "/ticket/appointment/?id=" + ' . $model->id .'&executor_id='.Yii::$app->user->id.'  })}',
                          ],


                    ],
                    ],

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question