2) For this you can specify the css file using the cssFile
attribute this defaults to "jquery-ui.css" you can change to your own file; see this documentation for more details
see http://www.yiiframework.com/doc/api/1.1/CJuiWidget#cssFile-detail
How can I change input type of Yii CJuiAutoComplete?
-
18-07-2023 - |
Question
I'm new to Yii and I've been able to use CJuiAutoComplete
for autocomplete.
I have two questions:
- By default, the input box is of type
text
. How can I change the type tosearch
? By default it uses jQuery UI CSS styling. How can I drop that and use my own styling?
$this->widget('zii.widgets.jui.CJuiAutoComplete', array( 'model' => $myModel, 'attribute' => 'name', 'source' => Yii::app()->createUrl('search/autocomplete'), 'options' => array( 'minLength' => '2', 'showAnim' => 'fold', 'select' => 'js: function(event, ui) { this.value = ui.item.value; $("#item_id").val(ui.item.id); return false; }', ), 'htmlOptions' => array( 'maxlength' => 50, 'type' => 'search' // <- This didn't work ), ));
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow