BiComboBox

This class represents a combo box.

This class extends BiComponent and therefore all methods and fields available for BiComponent are also available for BiComboBox .

Constructor

new BiComboBox ( [ oItems ] )

Parameters

NameTypeOptionalDefaultDescripton
oItemsString[]checkedArray with initial items to be created in the combo box

Properties

NameTypegetsetDescripton
currentDataPageNumbercheckedThe index of the current data page.
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.
editableBooleancheckedcheckedWhether the text field can be edited
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
popupBiPopupcheckedThe popup containing the drop down list.
selectedIndexNumbercheckedcheckedThe index of the currently selected item. -1 if none.
selectedItemBiComboBoxItemcheckedcheckedThe 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 combobox 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 combobox 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.
textBoxBiComponentcheckedThe text field at the top of the combo box. If the combo box is in an editable state a BiTextField is returned, if the combo box is non-editable a BiLabel will be returned.
textFieldBiTextFieldcheckedThe textfield of the combobox. Note: The text field is only useful if the combo box is in an editable state. Use the textBox property instead.
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
createItemFromDataRowCreates a BiComboBoxItem from a BiDataRow.
findStringSearches the items for an item that starts with the given string. This match is case insensitive. If no item is found this returns null
findStringExactSearches the items for an item that matches the given string. This match is case insensitive. If no item is found this returns null
findUserValueExactSearches the items for an item that has the given user value. If no item is found this returns null
findValueExactDeprecated. Use findUserValueExact instead.
sortSorts the items in the ComboBox. 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
activechangedBiEventFires when the active item changes.
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

createItemFromDataRow

Creates a BiComboBoxItem from a BiDataRow.

Syntax

object.createItemFromDataRow ( oRow )

Parameters

NameTypeOptionalDefaultDescripton
oRowBiDataRowThe data row to create item from

Return Type

BiComboBoxItem

findString

Searches the items for an item that starts with the given string. This match is case insensitive. If no item is found this returns null

Syntax

object.findString ( sText,nStartIndex )

Parameters

NameTypeOptionalDefaultDescripton
sTextStringThe text to search for
nStartIndexStringThe index to start the searching from

Return Type

BiComboBoxItem

findStringExact

Searches the items for an item that matches the given string. This match is case insensitive. If no item is found this returns null

Syntax

object.findStringExact ( sText,nStartIndex )

Parameters

NameTypeOptionalDefaultDescripton
sTextStringThe text to search for
nStartIndexStringThe index to start the searching from

Return Type

BiComboBoxItem

findUserValueExact

Searches the items for an item that has the given user value. If no item is found this returns null

Syntax

object.findUserValueExact ( oUserValue [ ,nStartIndex ] )

Parameters

NameTypeOptionalDefaultDescripton
oUserValueObjectThe user value to search for
nStartIndexNumbercheckedThe index to start the searching from

Return Type

BiComboBoxItem

findValueExact

Deprecated. Use findUserValueExact instead.

Syntax

object.findValueExact ( oUserValue [ ,nStartIndex ] )

Parameters

NameTypeOptionalDefaultDescripton
oUserValueObjectThe user value to search for
nStartIndexNumbercheckedThe index to start the searching from

Return Type

BiComboBoxItem

sort

Sorts the items in the ComboBox. 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

BiComboBox . createRegExpValidator ( oRegExp )

Parameters

NameTypeOptionalDefaultDescripton
oRegExpRegExpA regular expression object

Return Type

Function