Cjuiautocomplete can automatically prompt the user to enter text according to the first few characters entered by the user when entering. It encapsulates the JUI AutoComplete plug-in.
The basic usage is as follows
<?php
$this->widget (' Zii.widgets.jui.CJuiAutoComplete ', Array (
' name ' => ' city ',
' source ' = > $data,
//additional javascript options for the AutoComplete plugin
' Options ' =>array (
' minlength ' = > ' 2 ',
),
' Htmloptions ' =>array (
' style ' => ' height:20px; ')
;
? >
Automatically prompts the data source by configuring the Source property to complete, the actual application can be read through the database, files and so on. For simplicity, this example uses an array definition in Sitecontroller.
Public Function Actionindex ()
{
$data =array (' Nanjing ', ' Beijing ', ' Perth ',
' Chicago ', ' Paris ', ') ' Pengnai ', ' Sydney ');
$this->render (' index ', array (
' data ' => $data
);
}
See a full set of tutorials: http://www.bianceng.cn/webkf/PHP/201301/35265.htm
This example downloads: Http://www.imobilebbs.com/download/yii/JuiAutoCompleteDemo.zip