Yii通过renderPartial生成Widgets

由于项目涉及很多1对多的数据表,需要通过AJAX动态添加。不过再动态添加CJuiAutoComplete小部件的时候,只生成了输入框,没有自动提示功能。搜索一圈后再stackoverflow上发现了解决方法。

http://stackoverflow.com/questions/9757812/loading-zii-widget-cjuidatepicker-through-ajax-call-not-working?answertab=active#tab-top

简而言之,就是

model = new Date;
$this->renderPartial('_newDate', array(
    'model' => $model,
), false, true);



renderPartial的第四个参数。具体原因参考Yii的手册了。

你可能感兴趣的:(Ajax)