【发布时间】:2016-08-16 09:56:13
【问题描述】:
我一直在尝试在同一个 yii2 视图上为不同的引导模式加载远程内容
<?php
$label = $model->getAttributeLabel('educationId');
$addon = [
'prepend' => [
'content' => Html::icon('book')
],
'append' => [
'content' => Html::button(
Html::icon('plus'), [
'class' => 'btn btn-success',
'title' => 'Add New' . $label,
'onclick' => new JsExpression('showModal();'),
]
),
'asButton' => true
]
];
echo Html::tag('label',$model->getAttributeLabel('educationId'), ['class'=>'control-label']);
echo Select2::widget([
'model' => $model,
'attribute' => 'educationId',
'data' => ArrayHelper::map ( EducationLevel::find ()->all (), 'id', 'name' ),
'options' => ['placeholder' => 'Select Education Level ...','template' => 'label}\n{error}'],
'addon' => $addon,
'pluginOptions' => [
'maximumInputLength' => 10
],
]);
JS函数
Function showModal(){
$('#addEducationModal').modal({
remote: 'modal.html',
show: true
});
}
所以用户点击一个文本域的插件按钮,模态框就会出现,其他文本域应该有相同的机制,不同的模态内容。
但是我得到的只是褪色的背景。
【问题讨论】:
-
显示您的代码以重现问题。
-
@MikeBrant 代码已添加
标签: php jquery twitter-bootstrap web yii2