Answer the question
In order to leave comments, you need to log in
How to display certain values in the Selectize widget in YII2?
I need to make sure that when adding a record, the widget already has ready-made Tags, but how can I add them there? Thanks in advance!
The documentation did not give anything(
Link to the GitHub widget
Link to the plugin site
<?= $form->field($model, 'tagValues')->widget(SelectizeTextInput::className(), [
// calls an action that returns a JSON object with matched
// tags
'options' => ['class' => 'form-control'],
'clientOptions' => [
'valueField' => 'tagValues',
'labelField' => 'tagValues',
'searchField' => ['tagValues'],
'items' => ['tagValues'],
'create' => true,
],
]);
?>
Answer the question
In order to leave comments, you need to log in
If you can't use it, look away - demos.krajee.com/widget-details/select2
It might work.
'options' => ['class' => 'form-control', 'value'=>'hello,world' ],
<?= $form->field($model, 'tagValues')->widget(SelectizeTextInput::className(), [
'loadUrl' => ['tag/list'],
'options' => ['class' => 'form-control', 'value'=>'hello,world'],
'clientOptions' => [
'plugins' => ['remove_button','restore_on_backspace'],
'valueField' => 'label',
'labelField' => 'label',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question