我正在使用 TbSelect2 允许用户选择多个数据,然后它工作正常。但是当我尝试将它与模态一起使用时,它不起作用。有人有想法吗?提前致谢。
编辑:
视图.php
<?php $this->beginWidget('bootstrap.widgets.TbModal', array('id' => 'advanceModal')); ?>
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h4>User</h4>
</div>
<div class ="modal-body" id="newmodal">
</div>
<div class="modal-footer">
<?php
$this->widget('bootstrap.widgets.TbButton', array(
'label' => 'Close',
'url' => '#',
'htmlOptions' => array('data-dismiss' => 'modal'),
));
?>
</div>
<?php $this->endWidget(); ?>
<?php //code displaying a grid view here?>
<script>
//ajax call to go to the modal
</script>
模态的.php
<?php
//table
//code of select2
$this->widget('bootstrap.widgets.TbSelect2',array(
'model'=>$model,
'attribute'=>'name',
'data'=>CHtml::listData(User::model()->findAll(), 'id', 'label'),
'options'=>array(
'width'=>'200px',
'placeholder'=>' -- Please select trait-- ', // add this line
'allowClear'=>true,
),
'htmlOptions'=>array('multiple'=>'multiple',),
));
?>