phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
Autocomplete Class Reference

JQuery UI Autocomplete component. More...

+ Inheritance diagram for Autocomplete:

Public Member Functions

 __construct (JsUtils $js)
 
 setAjaxSource ($url)
 Define source property with an ajax request based on $url $url must return a JSON array of values.
 
 setSource ($source)
 Define the source property with a JSON Array of values Example : ["Bordeaux","Alsace","Bourgogne"] Example : [{value : "BO", label : "Bordeaux"}, {value : "AL", label : "Alsace"}, {value : "BOU", label : "Bourgogne"}].
 
 setAutofocus ($value)
 If set to true the first item will automatically be focused when the menu is shown.
 
 setDelay ($value)
 The delay in milliseconds between when a keystroke occurs and when a search is performed.
 
 setDisabled ($value)
 Disables the autocomplete if set to true.
 
 setMinLength ($value)
 The minimum number of characters a user must type before a search is performed.
 
 setPosition (Position $position)
 Identifies the position of the suggestions menu in relation to the associated input element.
 
 onChange ($jsCode)
 Triggered when the field is blurred, if the value has changed.
 
 onClose ($jsCode)
 Triggered when the menu is hidden.
 
 onFocus ($jsCode)
 Triggered when focus is moved to an item (not selecting).
 
 onOpen ($jsCode)
 Triggered when the suggestion menu is opened or updated.
 
 onResponse ($jsCode)
 Triggered after a search completes, before the menu is shown.
 
 onSearch ($jsCode)
 Triggered before a search is performed, after minLength and delay are met.
 
 onSelect ($jsCode)
 Triggered when an item is selected from the menu.
 
- Public Member Functions inherited from SimpleComponent
 getScript ()
 
 attach ($identifier)
 
 addEvent ($event, $jsCode)
 
 on ($event, $jsCode)
 
 getAttachTo ()
 
 getItemSelector ()
 
 setItemSelector ($itemSelector)
 
- Public Member Functions inherited from BaseComponent
 setParam ($key, $value)
 
 getParam ($key)
 
 getParams ()
 
 compile (JsUtils $js=NULL)
 
 setParams ($params)
 
 addParams ($params)
 
 setDebug ($value)
 
 setVerbose ($value)
 

Additional Inherited Members

- Data Fields inherited from BaseComponent
 $jquery_code_for_compile =array ()
 
- Protected Member Functions inherited from SimpleComponent
 compileEvents ()
 
 _createSelector ($itemSelector, $selector)
 
 compileJQueryCode ()
 
 setParamCtrl ($key, $value, $typeCtrl)
 
- Protected Member Functions inherited from BaseComponent
 getParamsAsJSON ($params)
 
- Protected Attributes inherited from SimpleComponent
 $attachTo
 
 $itemSelector
 
 $uiName
 
 $events
 
- Protected Attributes inherited from BaseComponent
 $params =array ()
 
 $js
 

Detailed Description

JQuery UI Autocomplete component.

Author
jc
Version
1.0.2

Definition at line 15 of file Autocomplete.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( JsUtils  $js)

Reimplemented from SimpleComponent.

Definition at line 17 of file Autocomplete.php.

Member Function Documentation

◆ onChange()

onChange (   $jsCode)

Triggered when the field is blurred, if the value has changed.

Parameters
string$jsCode
Returns
$this

Definition at line 129 of file Autocomplete.php.

◆ onClose()

onClose (   $jsCode)

Triggered when the menu is hidden.

Not every close event will be accompanied by a change event.

Parameters
string$jsCode
Returns
$this

Definition at line 140 of file Autocomplete.php.

◆ onFocus()

onFocus (   $jsCode)

Triggered when focus is moved to an item (not selecting).

The default action is to replace the text field's value with the value of the focused item, though only if the event was triggered by a keyboard interaction. Canceling this event prevents the value from being updated, but does not prevent the menu item from being focused.

Parameters
string$jsCode
Returns
$this

Definition at line 153 of file Autocomplete.php.

◆ onOpen()

onOpen (   $jsCode)

Triggered when the suggestion menu is opened or updated.

Parameters
string$jsCode
Returns
$this

Definition at line 163 of file Autocomplete.php.

◆ onResponse()

onResponse (   $jsCode)

Triggered after a search completes, before the menu is shown.

Useful for local manipulation of suggestion data, where a custom source option callback is not required. This event is always triggered when a search completes, even if the menu will not be shown because there are no results or the Autocomplete is disabled.

Parameters
string$jsCode
Returns
$this

Definition at line 175 of file Autocomplete.php.

◆ onSearch()

onSearch (   $jsCode)

Triggered before a search is performed, after minLength and delay are met.

If canceled, then no request will be started and no items suggested.

Parameters
string$jsCode
Returns
$this

Definition at line 186 of file Autocomplete.php.

◆ onSelect()

onSelect (   $jsCode)

Triggered when an item is selected from the menu.

The default action is to replace the text field's value with the value of the selected item. Canceling this event prevents the value from being updated, but does not prevent the menu from closing.

Parameters
string$jsCode
Returns
$this

Definition at line 198 of file Autocomplete.php.

◆ setAjaxSource()

setAjaxSource (   $url)

Define source property with an ajax request based on $url $url must return a JSON array of values.

Parameters
String$url
Returns
$this

Definition at line 30 of file Autocomplete.php.

◆ setAutofocus()

setAutofocus (   $value)

If set to true the first item will automatically be focused when the menu is shown.

default : false

Parameters
Boolean$value
Returns
$this

Definition at line 69 of file Autocomplete.php.

◆ setDelay()

setDelay (   $value)

The delay in milliseconds between when a keystroke occurs and when a search is performed.

A zero-delay makes sense for local data (more responsive), but can produce a lot of load for remote data, while being less responsive. default : 300

Parameters
int$value
Returns
$this

Definition at line 82 of file Autocomplete.php.

◆ setDisabled()

setDisabled (   $value)

Disables the autocomplete if set to true.

Parameters
Boolean$valuedefault : false
Returns
$this

Definition at line 93 of file Autocomplete.php.

◆ setMinLength()

setMinLength (   $value)

The minimum number of characters a user must type before a search is performed.

Zero is useful for local data with just a few items, but a higher value should be used when a single character search could match a few thousand items.

Parameters
int$valuedefault : 1
Returns
$this

Definition at line 106 of file Autocomplete.php.

◆ setPosition()

setPosition ( Position  $position)

Identifies the position of the suggestions menu in relation to the associated input element.

The of option defaults to the input element, but you can specify another element to position against. You can refer to the jQuery UI Position utility for more details about the various options.

Parameters
int$positiondefault : { my: "left top", at: "left bottom", collision: "none" }
Returns
$this

Definition at line 119 of file Autocomplete.php.

◆ setSource()

setSource (   $source)

Define the source property with a JSON Array of values Example : ["Bordeaux","Alsace","Bourgogne"] Example : [{value : "BO", label : "Bordeaux"}, {value : "AL", label : "Alsace"}, {value : "BOU", label : "Bourgogne"}].

Parameters
String$source
Returns
$this

Definition at line 54 of file Autocomplete.php.


The documentation for this class was generated from the following file: