Answer the question
In order to leave comments, you need to log in
Why doesn't templateResult work for kartik-v select2?
the code
<?= $form->field($model, 'color')->widget(Select2::class,[
'data'=>ProjectStageField::$colorClass,
'pluginOptions'=>[
/*'escapeMarkup' => new JsExpression('function (state) {return \'<span class="badge badge-lg badge-\'+state.id+\'">\'+state.id+\' </span>\';}'),*/
'templateResult' => new JsExpression('function (state) {return \'<div class="col flex-shrink-0 table-custom-stage"><span class="badge badge-lg badge-\'+state.id+\'">\'+state.id+\' </span></div>\';}'),
'templateSelection' => new JsExpression('function (state) {return \'<div class="col flex-shrink-0 table-custom-stage"><span class="badge badge-lg badge-\'+state.id+\'">\'+state.id+\' </span></div>\';}'),
]
]) ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question