getOption($key) to obtain the desired option
where $key is a name listed in the table below
and
setOption(string $option, [mixed $value = null] ) to set a new option.
The method can be called several times in order to set or overwrite existing option.
Example: If we want to change the minial characters before autocomplete lunches, the we can do this:
<?php ... $ac = new jqAutocomplete($conn); // We use the northwind database // Set the SQL command $ac->SelectCommand = "SELECT CompanyName FROM customers WHERE CompanyName LIKE ? ORDER BY CompanyName"; // Set from where to get the dat. In this case from the same file $ac->setSource("firstautocomplete.php"); // set the minLength option $ac->setOption('minLength', 3); // Enjoy $ac->renderAutocomplete("#company"); ?>
Bellow is a list of all available grid options
Type |
Name |
Description |
Default |
---|---|---|---|
string |
appendTo |
You can now define which element the menu is appended to. The default is to append to the body, which is the previous behavior. The appendTo option take any valid selector. If the selector matches multiple elements, the menu will be appended to the first matched item. |
false |
boolean |
disabled |
Disables (true) or enables (false) the autocomplete. Can be set when initialising (first creating) the autocomplete. |
false |
integer |
delay |
The delay in milliseconds the Autocomplete waits after a keystroke to activate itself. A zero-delay makes sense for local data (more responsive), but can produce a lot of load for remote data, while being less responsive. |
300 |
integer |
minLength |
The minimum number of characters a user has to type before the Autocomplete activates. Zero is useful for local data with just a few items. Should be increased when there are a lot of items, where a single character would match a few thousand items. |
1 |
array |
position |
You can now define where the menu will be displayed. The default is to display the menu below the text field, with the left edges aligned. More on this can be found here |
false |
Other options can be set using the properties of the class. Refer to Autocomplete Variables