Forked from vrushank-snippets/Yii : Auto Complete In Grid
Created
February 24, 2014 03:06
-
-
Save dika46/9181283 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array( | |
'name'=>'name', | |
'type'=>'raw', | |
'value'=>'$data->name', | |
'filter'=>$this->widget('zii.widgets.jui.CJuiAutoComplete', array( | |
'model'=>$model, | |
'attribute'=>'name', | |
'source'=>$this->createUrl('user/usersAutoComplete'), | |
'options'=>array( | |
'focus'=>"js:function(event, ui) { | |
$('#".CHtml::activeId($model,'name')."').val(ui.item.value); | |
}", | |
'select'=>"js:function(event, ui) { | |
$.fn.yiiGridView.update('user-grid', { | |
data: $('#user-grid .filters input, #user-grid .filters select').serialize() | |
}); | |
}" | |
), | |
),true), | |
), | |
'afterAjaxUpdate'=>"function(){ | |
jQuery('#".CHtml::activeId($model,'name')."').autocomplete({ | |
'delay':300, | |
'minLength':1, | |
'source':'".$this->createUrl('user/usersAutoComplete')."', | |
'focus':function(event, ui) { | |
$('#".CHtml::activeId($model,'name')."').val(ui.item.value); | |
}, | |
'select':function(event, ui) { | |
$.fn.yiiGridView.update('user-grid', { | |
data: $('#user-grid .filters input, #user-grid .filters select').serialize() | |
}); | |
} | |
}); | |
}", | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment