我正在尝试在我的项目中实现 CJuiAutoComplete 但它不起作用。在过去的几天里,我已经研究了这个问题并尝试了一切。似乎正在发生(或在这种情况下没有发生)是控制器中的查找操作没有被调用。如果我将源设置为一个简单的项目数组,我也无法让它工作。我究竟做错了什么?
_form.php
<?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'model' => $model,
'attribute' => 'zipcode',
'source' => $this->createUrl('address/lookup'),
'name' => 'zipcode',
'htmlOptions' => array('size'=>'5'),
'options' => array(
'showAnim'=>'fold',
'minLength' => 1,
)) ?>
地址控制器.php
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update','lookup'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete'),
'users'=>array('admin'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
public function actionLookup()
{
echo "Lookup Action";
}