Hi. I’m using YiiBooster 2.1.1 (but I tried the latest 3.x and behaves the same). I have a Select2 widged used for search defined this way:
$this->widget('bootstrap.widgets.TbSelect2', array(
'name' => 'fieldid',
'value' => array (),
'data' => CHtml::listData(Model1::model()->findAll(), 'id', 'codiceDescrizione'),
'htmlOptions' => array(
'multiple' => 'multiple',
),
'options' => array(
'placeholder' => 'Filtra per sede',
'width' => '90%',
),
));
It works great. By default there’s no selection, then I can add elements from the data result and I refine the search. The problem comes if I want to return to the original situation, with no filter: if I remove all elements from the widget, the Ajax POST still contains the last selected ID! I tried adding allowClear but it has no effect for multiple enabled widget. Any hint on how to clear selection?
thanks