Answer the question
In order to leave comments, you need to log in
How to display labels in kartik\grid\ExpandRowColumn from Select2 widget separately from each other:?
Now I have the value of the labels displayed in ExpandRowColumn
Now I have this:
I'm trying to do this:
[
'attribute' => 'tag',
'format' => 'raw',
'contentOptions' => ['class' => 'tr110'],
'value' => function($model){
return $model->tags != null ? '<div class="markerOrder">'.$model->getTagsAsString('gridview').'</div>' : false;
}
],
public function getTagsAsString($view)
{
if ($view == 'gridview'){
$tags = array_slice($this->tags, 0, 5);
$arr = ArrayHelper::map($tags, 'id', 'name');
} else {
$arr = ArrayHelper::map($this->tags, 'id', 'name');
}
return implode(', ', $arr);
}
<?= $form->field($model, 'tags_array')->widget(Select2::className(), [
'data' => ArrayHelper::map(Tag::find()->all(), 'id', 'name'),
'language' => 'ru',
'options' => [
'placeholder' => 'Выберите тэг',
'multiple' => true
],
'pluginOptions' => [
'allowClear' => true,
'tags' => true,
'maximumInputLength' => 10,
],
]);
?>
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