autocomplete - Yii CJuiAutoComplete data from Ajax request does not display list choice -
autocomplete not display data sourceurl;
controller
public function actiontestautocomplete() { $r = array( array("label"=>"test 1", "value"=>"test 1") , array("label"=>"test 2", "value"=>"test 2") , array("label"=>"test 3", "value"=>"test 3") , array("label"=>"test 4", "value"=>"test 4") , ); echo cjson::encode($r); } view
$this->widget('zii.widgets.jui.cjuiautocomplete', array( 'name' => 'test_autocomplete', 'source'=>$this->createurl("testautocomplete"), 'value' => "", 'options' => array( 'minchars'=>1, 'autofill'=>false, 'focus'=> 'js:function( event, ui ) { $( "#test_autocomplete" ).val( ui.item.label ); return false; }', 'select'=>'js:function( event, ui ) { return false; }' ), 'htmloptions'=>array( 'autocomplete'=>'off'), )); the action testautocomplete works in debug, autocomplete not display data ajax.
the code bellow work fine.
$this->widget('zii.widgets.jui.cjuiautocomplete', array( 'name' => 'test_autocomplete', 'source'=>array( array('label'=>'test 1', 'value'=>'teste 1'), array('label'=>'test 2', 'value'=>'teste 2'), array('label'=>'test 3', 'value'=>'teste 3'), ), 'value' => "", 'options' => array( 'minchars'=>1, 'autofill'=>false, 'focus'=> 'js:function( event, ui ) { $( "#test_autocomplete" ).val( ui.item.label ); return false; }', 'select'=>'js:function( event, ui ) { return false; }' ), 'htmloptions'=>array( 'autocomplete'=>'off'), )); please, need help,
thanks
try using sourceurl instead source option.
Comments
Post a Comment