Closed RomeroMsk closed 10 years ago
No you can't... you have to use the following format:
echo $form->field($searchModel, 'name')->widget(Selectize::className(), [...]);
That's what I need, thank you.
How can I make multiselect when using selectize via widget() method? The only way I've found:
<?= $form->field($searchModel, 'status_id')->widget(Selectize::className(), [
'items' => ArrayHelper::getColumn(Structure::instance()->statuses, 'name'),
'clientOptions' => [
'maxItems' => null, // This will convert single select to multiple
],
]) ?>
But in this case your widget will generate single 'select' tag with first option selected and only after that selectize.js will convert itself to multiselect, so first option will be selected:
If I set 'multiple' attribute on input via 'inputOptions', widget will reset it. I think, the best way to use multiselects with your widget is adding a config option and checking it in run() method. Something like this:
public function run()
{
if ($this->multiple) {
$this->options['multiple'] = true;
}
...
}
Hello! Can you show me how to use your widget with ActiveForm field? I have this code now:
Can't I write something like this?