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

Name Type Optional Default Descripton
oItems String[] checked Array with initial items to be created in the combo box

Properties

Name Type get set Descripton
currentDataPage Number checked The index of the current data page.
dataPageCount Number checked 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 checked The amount of rows to show at one time from the data source.
dataSource BiDataTable / BiDataSet checked 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 checked checked The name of the column to use as the data for the text property of the combo box items.
dataUserValueField String checked checked The name of the column to use as the data for the userValue property of the combo box items.
dropDownWidth Number checked checked 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 checked checked Whether the combo box is displaying its drop-down list.
editable Boolean checked checked Whether the text field can be edited
invalidMessage String checked checked A string that can be used to describe why the input is invalid
isValid Boolean checked This will call the validator (if any) and return true if the text is valid
popup BiPopup checked The popup containing the drop down list.
selectedIndex Number checked checked The index of the currently selected item. -1 if none.
selectedItem BiComboBoxItem checked checked The selected combo box item. If no item is selected this will be null. When this changes the change event fires.
selectionModel BiSelectionModel checked Gets the selection-model for the drop-down list.
sortFunction Function checked checked Compare 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.
sortType String checked checked Sets 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
text String checked checked 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.
textBox BiComponent checked The 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.
textField BiTextField checked The 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.
userValue Object checked checked 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 checked checked A function that is used to validate the text
value Object checked checked Deprecated. Use userValue instead.

Methods

Name Description
createItemFromDataRow Creates a BiComboBoxItem from a BiDataRow.
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
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
findUserValueExact Searches the items for an item that has the given user value. If no item is found this returns null
findValueExact Deprecated. Use findUserValueExact instead.
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.

Events

Name Type Bubbles Descripton
activechanged BiEvent Fires when the active item changes.
change BiEvent Fires when the selectedItem changes.
databind BiEvent Called after the component has been data bound
textchanged BiEvent 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

Method Details

createItemFromDataRow

Creates a BiComboBoxItem from a BiDataRow.

Syntax

object.createItemFromDataRow
 (
 oRow
 )
 

Parameters

Name Type Optional Default Descripton
oRow BiDataRow The 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

Name Type Optional Default Descripton
sText String The text to search for
nStartIndex String The 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

Name Type Optional Default Descripton
sText String The text to search for
nStartIndex String The 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

Name Type Optional Default Descripton
oUserValue Object The user value to search for
nStartIndex Number checked The index to start the searching from

Return Type

BiComboBoxItem

findValueExact

Deprecated. Use findUserValueExact instead.

Syntax

object.findValueExact
 (
 oUserValue
 [
 ,nStartIndex
 ]
 
 )
 

Parameters

Name Type Optional Default Descripton
oUserValue Object The user value to search for
nStartIndex Number checked The 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

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

BiComboBox
 .
 createRegExpValidator
 (
 oRegExp
 )
 

Parameters

Name Type Optional Default Descripton
oRegExp RegExp A regular expression object

Return Type

Function