我有:
视图- _form.php
echo CHtml::ajaxLink(CHtml::image('/images/plus.png', ''),
$url = CController::createUrl('User/Dynamicreference'), $ajaxOptions=array (
'type'=>'POST',
'success'=>'function(data){ $(body).append(data);}'
)
);和UserController.php
public function actionDynamicreference(){
$this->widget('CMaskedTextField', array(
'name' => 'Items[items_reference][]',
'value' => '',
'mask' => '999999',
));
}掩码输入在AJAX加载后不工作(jQuery在AJAX请求之后不执行)。我该如何解决这个问题?
发布于 2014-01-21 06:41:20
解决方案在第四个参数processOutput of CController.renderPartial()中。将其设置为true,您将在ajax请求上获得jquery.maskedinput插件。
//行动
// ...
if (Yii::app()->request->isAjaxRequest)
{
$content = $this->renderPartial('content', null, true, true);
echo $content;
Yii::app()->end();
}
// ...//视图文件content.php
<?php $this->widget('CMaskedTextField', array('mask'=>'99:99:99','name'=>'someName')); ?>https://stackoverflow.com/questions/21236852
复制相似问题