BiList

This is a list component that can contain BiListItem objects. It uses the normal object model and can therefore be extended and used just like any other component. The only limitation is that the the direct children should only be of type BiListItem and the size and position of these should not be changed.

The list uses a BiListSelectionModel that handles the selection.

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

Constructor

new BiList ( )

Parameters

No parameters.

Properties

Name Type get set Descripton
allowInlineFind Boolean checked checked When true, typing a word will select the first matching item.
currentDataPage Number checked 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 checked The amount of rows to show at one time from the data source.
dataSource BiDataTable / BiDataSet checked 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 BiListItems.
dataUserValueField String checked checked The name of the column to use as the data for the userValue property of the BiListItems.
multipleSelection Boolean checked checked Whether the list supports multiple selection
selectedItem BiListItem checked This is a convenience method that returns the first selected item. This is same as list.getSelectedItems()[0].
selectedItems BiListItem[] checked Returns an array containing the selected list items.
selectionModel BiListSelectionModel checked checked This handles the selection of the items in the list
sortFunction Function checked checked Sets a property which is a function used to compare two listItems. This function should take two arguments and return 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 Used to decide how to sort the list items. It is used when calling sort() if the sortFunction property has not been set to a function. If the list items has its userValue property set, it has precedence over its text property in being the value that is compared Built in support for the following types:

string (default)
caseInsensitiveString
number
date - Uses the native JS Date type

To get better control over the sorting, define a function and set the sortFunction property.
userValue Object checked checked This is the userValue of the first selected list item. If no item is selected then this returns null.
userValues Object[] checked This is an array containing the user values of the selected list items.

Methods

Name Description
createItemFromDataRow This method is called when using data binding. This is used to create a new BiListItem from a BiDataRow.
dataBind If the list has a dataSource then this binds that data source to the list.
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 list items for an item that has the given user value. If no item is found this returns null
sort Sorts the items in the List. 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 BiEvent Fires when the selected items change
databind BiEvent Called after the component has been data bound

Static Methods

None.

Static Fields

None.

Remarks

Only BiListItems should be added to the list. Other components might result in unexpected behaviors.

Method Details

createItemFromDataRow

This method is called when using data binding. This is used to create a new BiListItem from a BiDataRow.

Syntax

object.createItemFromDataRow
 (
 oRow
 )
 

Parameters

Name Type Optional Default Descripton
oRow BiDataRow This is the row to create a new BiListItem from.

Return Type

BiListItem

dataBind

If the list has a dataSource then this binds that data source to the list.

Syntax

object.dataBind
 (
 
 )
 

Parameters

No arguments.

Return Type

void

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 Number checked 0 The index to start the searching from

Return Type

BiListItem

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 Number checked 0 The index to start the searching from

Return Type

BiListItem

findUserValueExact

Searches the list 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 value to search for
nStartIndex Number checked 0 The index to start the searching from

Return Type

BiListItem

sort

Sorts the items in the List. 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 Bool Whether to update the List

Return Type

Array : the sorted list of items