$.jec([options[, settings]])$.jec([options[, settings]]) Initializes editable combobox from scratch. It will create select element and option-child elements based on the passed values. Parameters| Type | Name | Description | Default value | Added in | | array | options | default options, values in array can be either an objects, strings or numbers | [] | 1.2 | | object | settings | plugin settings | {} | 1.2 |
Notes- if object will be passed as an element of options array all it's keys will be transferred to predefined options where key will be used as a <option> value and value will be <option> text.
- if strings or numbers will be passed as an elements of options array they will become both values and texts of the predefined <option> elements that will be created by the plugin
- settings are exactly the same as for jec() method
Options| Type | Name | Description | Default value | Added in | | int | position | index of editable option to be inserted in select | 0 | 1.2 | | string | array | classes | additional classes to be added | [] | 1.2 | | object | styles | additional CSS properties to be set | {} | 1.2 | | string | array | optionClasses | additional classes to be added to editable option element | [] | 1.2 | | object | optionStyles | additional CSS properties to be set for editable option element | {} | 1.2 | | bool | focusOnNewOption | moves focus to newly created option element if set to true | false | 1.2 | | bool | useExistingOptions | uses selected <option> text as a base for editable option if set to true, otherwise editable option base is empty string | false | 1.2 | | array | ignoredKeys | ignored key codes, values in array can be either a {min: MIN_VALUE, max: MAX_VALUE} , {exact: VALUE} value or integers | [] | 1.2 | | array | acceptedKeys | accepted key codes, values in array can be either a {min: MIN_VALUE, max: MAX_VALUE} , {exact: VALUE} value or integers | [{min:32, max:126}, {min:191, max:382}] | 1.2 |
Notes- while all other preferences can be changed on runtime using jecPref() method, changing focusOnNewOption has no effect on plugin behaviour because this preference is used only when the combobox is initialized
- ignoredKeys have higher priority then acceptedKeys which means if there is the same key code in both arrays then it will be ignored
Returned ValueThis method returns jQuery object with initialized editable comboboxes.
|