select2row is successfully fetching data from ajax call but I want to set up minlength and delay options, but they are not working.\
Any idea from any one please?
below is my code which is working with ajax call
in _form:
<?php echo $form->select2Row($model, 'city', array(
//'hint'=>'Select your city',
// 'data'=>GxHtml::listData(City::model()->findAll(),'city_id', 'city_name'),
'asDropDownList' => false,
'options' => array(
‘delay’=>300,
‘minLength’=>3,
'width' => '40%',
'closeOnSelect' => false,
'placeholder' => 'Select City',
'allowClear' => false,
'ajax' => array(
'url' => CController::createUrl('agent/ajaxgetcity'),
'dataType' => 'json',
'data' => 'js:function(term,page) { return {q: term, page_limit: 10, page: page}; }',
'results' => 'js:function(data,page) { return {results: data}; }',
),
)));
?>
In controller:
public function actionAjaxGetCity() {
if (isset($_GET['q'])) {
$cts = City::model()->findAll(array('order'=>'city_name', 'condition'=>'city_name LIKE :city_name', 'params'=>array(':city_name'=>$_GET['q'].'%')));
$data = array();
foreach ($cts as $value) {
$data[] = array(
'id' => $value->city_id,
'text' => $value->city_name,
);
}
echo CJSON::encode($data);
}
Yii::app()->end();
}