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 |
![]() |
![]() |
When true, typing a word will select the first matching item. |
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 BiListItems. |
dataUserValueField |
String |
![]() |
![]() |
The name of the column to use as the data for the userValue
property of the BiListItems. |
multipleSelection |
Boolean |
![]() |
![]() |
Whether the list supports multiple selection |
selectedItem |
|
![]() |
This is a convenience method that returns the first selected item.
This is same as list.getSelectedItems()[0]. |
|
selectedItems |
|
![]() |
Returns an array containing the selected list items. | |
selectionModel |
|
![]() |
![]() |
This handles the selection of the items in the list |
sortFunction |
Function |
![]() |
![]() |
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 |
![]() |
![]() |
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 typeTo get better control over the sorting, define a function and set the sortFunction property. |
userValue |
Object |
![]() |
![]() |
This is the userValue of
the first selected list item.
If no item is selected then this returns null. |
userValues |
Object[] |
![]() |
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 |
|
Fires when the selected items change | |
databind |
|
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 |
|
This is the row to create a new BiListItem from. |
Return Type
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 |
![]() |
0 |
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 |
Number |
![]() |
0 |
The index to start the searching from |
Return Type
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 |
![]() |
0 |
The index to start the searching from |
Return Type
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
