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

NameTypegetsetDescripton
allowInlineFindBooleancheckedcheckedWhen true, typing a word will select the first matching item.
currentDataPageNumbercheckedcheckedThe 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.
dataPageSizeNumbercheckedcheckedThe amount of rows to show at one time from the data source.
dataSourceBiDataTable / BiDataSetcheckedcheckedThe 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 BiListItems.
dataUserValueFieldStringcheckedcheckedThe name of the column to use as the data for the userValue property of the BiListItems.
multipleSelectionBooleancheckedcheckedWhether the list supports multiple selection
selectedItemBiListItemcheckedThis is a convenience method that returns the first selected item. This is same as list.getSelectedItems()[0].
selectedItemsBiListItem[]checkedReturns an array containing the selected list items.
selectionModelBiListSelectionModelcheckedcheckedThis handles the selection of the items in the list
sortFunctionFunctioncheckedcheckedSets 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.
sortTypeStringcheckedcheckedUsed 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.
userValueObjectcheckedcheckedThis is the userValue of the first selected list item. If no item is selected then this returns null.
userValuesObject[]checkedThis is an array containing the user values of the selected list items.

Methods

NameDescription
createItemFromDataRowThis method is called when using data binding. This is used to create a new BiListItem from a BiDataRow.
dataBindIf the list has a dataSource then this binds that data source to the list.
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 list items for an item that has the given user value. If no item is found this returns null
sortSorts 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

NameTypeBubblesDescripton
changeBiEventFires when the selected items change
databindBiEventCalled 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

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

NameTypeOptionalDefaultDescripton
sTextStringThe text to search for
nStartIndexNumberchecked0 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

NameTypeOptionalDefaultDescripton
sTextStringThe text to search for
nStartIndexNumberchecked0 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

NameTypeOptionalDefaultDescripton
oUserValueObjectThe value to search for
nStartIndexNumberchecked0 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

NameTypeOptionalDefaultDescripton
updateBooleanWhether to update the List

Return Type

Array : the sorted list of items