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[] | ![]() | Array with initial items to be created in the combo box |
Properties
| Name | Type | get | set | Descripton |
currentDataPage | Number | ![]() | The index of the current data page. | |
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. |
editable | Boolean | ![]() | ![]() | Whether the text field can be edited |
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 | |
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 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 | ![]() | ![]() | 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 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. |
textBox | | ![]() | 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 | | ![]() | 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 | ![]() | ![]() | 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 |
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 | | Fires when the active item changes. | |
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
createItemFromDataRow
Creates a BiComboBoxItem from a BiDataRow.
Syntax
object.createItemFromDataRow ( oRow ) Parameters
| Name | Type | Optional | Default | Descripton |
oRow | | The data row to create item from |
Return Type
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
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
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 | ![]() | The index to start the searching from |
Return Type
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 | ![]() | The index to start the searching from |
Return Type
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
