Forked from vrushank-snippets/Yii : Auto Complete In Grid
Created
March 14, 2020 09:40
-
-
Save raihan-uddin/75785189e457c81f362e892f1bf063d0 to your computer and use it in GitHub Desktop.
Yii : Auto Complete In Grid
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