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

NameTypeOptionalDefaultDescripton
oDataModelBiAbstractAutoCompleteDataModelcheckedThe data model or if the parameter is an Array a BiArrayAutoCompleteDataModel will be created with the array as input

Properties

NameTypegetsetDescripton
currentDataPageNumbercheckedThe index of the current data page.
dataModelBiPopupcheckedcheckedThe maximum number of items.
dataPageCountNumbercheckedThe 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.
dataPageSizeNumbercheckedThe amount of rows to show at one time from the data source.
dataSourceBiDataTable / BiDataSetcheckedThe 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).
dataTextFieldStringcheckedcheckedThe name of the column to use as the data for the text property of the combo box items.
dataUserValueFieldStringcheckedcheckedThe name of the column to use as the data for the userValue property of the combo box items.
dropDownWidthNumbercheckedcheckedThe 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.
dropDownVisibleBooleancheckedcheckedWhether the combo box is displaying its drop-down list.
invalidMessageStringcheckedcheckedA string that can be used to describe why the input is invalid
isValidBooleancheckedThis will call the validator (if any) and return true if the text is valid
maximumItemNumBiPopupcheckedThe maximum number of items.
popupBiPopupcheckedThe popup containing the drop down list.
selectedIndexNumbercheckedcheckedThe index of the currently selected item. -1 if none.
selectedItemBiAutoCompleteItemcheckedcheckedThe selected combo box item. If no item is selected this will be null. When this changes the change event fires.
selectionModelBiSelectionModelcheckedGets the selection-model for the drop-down list.
sortFunctionFunctioncheckedcheckedCompare 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.
sortTypeStringcheckedcheckedSets 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 type
To get better control over the sorting, set the sortFunction property
textStringcheckedcheckedThe 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.
textFieldBiTextFieldcheckedThe textfield of the autoComplete.
userValueObjectcheckedcheckedThis 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.
validatorFunctioncheckedcheckedA function that is used to validate the text
valueObjectcheckedcheckedDeprecated. Use userValue instead.

Methods

NameDescription
addItemTextAdds a new BiAutoCompleteItem to the list of possible matches
createItemFromDataRowCreates a BiAutoCompleteItem from a BiDataRow.
sortSorts 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

NameTypeBubblesDescripton
changeBiEventFires when the selectedItem changes.
databindBiEventCalled after the component has been data bound
textchangedBiEventFires when the text changes in the text field of the combo box. To get the new text use the text property.

Static Methods

NameDescription
createRegExpValidatorThis 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

NameTypeOptionalDefaultDescripton
sTextStringthe text of the new item

Return Type

void

createItemFromDataRow

Creates a BiAutoCompleteItem from a BiDataRow.

Syntax

object.createItemFromDataRow ( oRow )

Parameters

NameTypeOptionalDefaultDescripton
oRowBiDataRowThe data row to create item from

Return Type

BiAutoCompleteItem

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

NameTypeOptionalDefaultDescripton
updateBooleanWhether 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

NameTypeOptionalDefaultDescripton
oRegExpRegExpA regular expression object

Return Type

Function