BiAutoComplete
This class represents an auto complete textbox.
This class extends BiComponent and therefore all methods and fields available for BiComponent are also available for BiAutoComplete .
Constructor
new BiAutoComplete ( [ oDataModel ] )
Parameters
| Name | Type | Optional | Default | Descripton |
oDataModel | | ![]() | The data model or if the parameter is an Array a BiArrayAutoCompleteDataModel will be created with the array as input |
Properties
| Name | Type | get | set | Descripton |
currentDataPage | Number | ![]() | The index of the current data page. | |
dataModel | | ![]() | ![]() | The maximum number of items. |
dataPageCount | Number | ![]() | The number of data pages that are available. This is the numbers of rows in the data set divided by the number of rows per page. | |
dataPageSize | Number | ![]() | The amount of rows to show at one time from the data source. | |
dataSource | | ![]() | The object to use as the data source. This can be a either a BiDataTable or a BiDataSet (in which case the first table is used). | |
dataTextField | String | ![]() | ![]() | The name of the column to use as the data for the text property of the combo box items. |
dataUserValueField | String | ![]() | ![]() | The name of the column to use as the data for the userValue property of the combo box items. |
dropDownWidth | Number | ![]() | ![]() | The desired width of the drop-down list. The width of the drop-down is always greater than or equal to the width of the combo box. |
dropDownVisible | Boolean | ![]() | ![]() | Whether the combo box is displaying its drop-down list. |
invalidMessage | String | ![]() | ![]() | A string that can be used to describe why the input is invalid |
isValid | Boolean | ![]() | This will call the validator (if any) and return true if the text is valid | |
maximumItemNum | | ![]() | The maximum number of items. | |
popup | | ![]() | The popup containing the drop down list. | |
selectedIndex | Number | ![]() | ![]() | The index of the currently selected item. -1 if none. |
selectedItem | | ![]() | ![]() | The selected combo box item. If no item is selected this will be null. When this changes the change event fires. |
selectionModel | | ![]() | Gets the selection-model for the drop-down list. | |
sortFunction | Function | ![]() | ![]() | Compare function used to sort autoComplete items. The function takes two arguments and returns a number (just like the normal comparison function used when sorting arrays in JavaScript). If this property is not set, it uses the predefined functions set by the sortType property. |
sortType | String | ![]() | ![]() | Sets built in sort method to use to sort the autoComplete items, this property is only used in the absence of a custom sort method. Valid settings are: (see BiSort for more details) string caseInsensitiveString number date - Uses the native JS Date typeTo get better control over the sorting, set the sortFunction property |
text | String | ![]() | ![]() | The text shown in the combo box. This can be used to find the text that the user is currently typing into the text field of the combo box. |
textField | | ![]() | The textfield of the autoComplete. | |
userValue | Object | ![]() | ![]() | This is the userValue of the selected combo box item. If no item is selected then this returns null. When setting this, the first item with the given user value will be selected. If no item has this value the selection will not change. |
validator | Function | ![]() | ![]() | A function that is used to validate the text |
value | Object | ![]() | ![]() | Deprecated. Use userValue instead. |
Methods
| Name | Description |
addItemText | Adds a new BiAutoCompleteItem to the list of possible matches |
createItemFromDataRow | Creates a BiAutoCompleteItem from a BiDataRow. |
sort | Sorts the items in the AutoComplete. If the sortFunction property is set to a proper sort function that takes two items and returns a Number, it uses this. If the sortFunction property is not set it will use the predefined sort function defined by the sortType property. |
Events
| Name | Type | Bubbles | Descripton |
change | | Fires when the selectedItem changes. | |
databind | | Called after the component has been data bound | |
textchanged | | Fires when the text changes in the text field of the combo box. To get the new text use the text property. |
Static Methods
| Name | Description |
createRegExpValidator | This method is useful when assigning regular expressions as validation functions. |
Static Fields
None.
Remarks
None.
Method Details
addItemText
Adds a new BiAutoCompleteItem to the list of possible matches
Syntax
object.addItemText ( sText ) Parameters
| Name | Type | Optional | Default | Descripton |
sText | String | the text of the new item |
Return Type
void
createItemFromDataRow
Creates a BiAutoCompleteItem from a BiDataRow.
Syntax
object.createItemFromDataRow ( oRow ) Parameters
| Name | Type | Optional | Default | Descripton |
oRow | | The data row to create item from |
Return Type
sort
Sorts the items in the AutoComplete. If the sortFunction property is set to a proper sort function that takes two items and returns a Number, it uses this. If the sortFunction property is not set it will use the predefined sort function defined by the sortType property.
Syntax
object.sort ( update ) Parameters
| Name | Type | Optional | Default | Descripton |
update | Boolean | Whether to update the List |
Return Type
Array : the sorted list of items
Static Method Details
createRegExpValidator
This method is useful when assigning regular expressions as validation functions.
Syntax
BiAutoComplete . createRegExpValidator ( oRegExp ) Parameters
| Name | Type | Optional | Default | Descripton |
oRegExp | RegExp | A regular expression object |
Return Type
Function
