Constructor
new List(initialItemsopt, searchEnabledopt, addEnabledopt, selectModeopt, longPressMultipleSelection, …args)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
initialItems |
Array.<qui.lists.ListItem> |
<optional> |
initial list items |
searchEnabled |
Boolean |
<optional> |
set to |
addEnabled |
Boolean |
<optional> |
set to |
selectMode |
String |
<optional> |
one of: |
longPressMultipleSelection |
Boolean | set to |
|
args |
* |
<repeatable> |
parent class parameters |
Methods
addItem(index, item)
Add one item to the list.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | the index where the item should be added; |
item |
qui.lists.ListItem | the item |
- Source:
disableAdd()
Disable the add feature.
- Source:
disableSearch()
Disable the search feature.
- Source:
enableAdd()
Enable the search feature.
- Source:
enableSearch()
Enable the search feature.
- Source:
getItems() → {Array.<qui.lists.ListItem>}
Return all items.
- Source:
Returns:
- Type
- Array.<qui.lists.ListItem>
getSelectedItems() → {Array.<qui.lists.ListItem>}
Return the currently selected items.
- Source:
Returns:
- Type
- Array.<qui.lists.ListItem>
isAddEnabled() → {Boolean}
Tell if the add feature is enabled
- Source:
Returns:
- Type
- Boolean
isSearchEnabled() → {Boolean}
Tell if the search feature is enabled
- Source:
Returns:
- Type
- Boolean
onAdd() → (nullable) {Promise}
Override this to define the behavior of the list when the add button is pressed.
- Source:
Returns:
an optional promise which, if rejected with no argument, will cancel adding
- Type
- Promise
onSelectionChange(oldItems, newItems) → (nullable) {Promise}
Called when the current selection is changed by user.
Parameters:
Name | Type | Description |
---|---|---|
oldItems |
Array.<qui.lists.ListItem> | the previously selected items (can be empty) |
newItems |
Array.<qui.lists.ListItem> | the new selected items (can be empty) |
- Source:
Returns:
an optional promise which, if rejected with no argument, will cancel the selection change
- Type
- Promise
prepareItem(item)
Prepare item to be part of this list.
Parameters:
Name | Type | Description |
---|---|---|
item |
qui.lists.ListItem |
- Source:
removeItem(item) → {Boolean}
Remove a specific item.
Parameters:
Name | Type | Description |
---|---|---|
item |
qui.lists.ListItem | the item to remove |
- Source:
Returns:
true
if item found and removed, false
otherwise
- Type
- Boolean
removeItemAt(index) → (nullable) {qui.lists.ListItem}
Remove the item at a given index.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | the index of the item to remove |
- Source:
Returns:
the removed item
- Type
- qui.lists.ListItem
removeItems(matchFunc) → {Array.<qui.lists.ListItem>}
Remove all items that match a condition.
Parameters:
Name | Type | Description |
---|---|---|
matchFunc |
qui.lists.ListItemMatchFunc |
- Source:
Returns:
the removed items
- Type
- Array.<qui.lists.ListItem>
setItem(index, item)
Update one item.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | the index where to perform the update |
item |
qui.lists.ListItem | the item to update |
- Source:
setItems(items)
Set the items of the list.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<qui.lists.ListItem> | list items |
- Source:
setSelectedItems(items)
Update current selection.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<qui.lists.ListItem> | the list of new items to select; empty list clears selection |
- Source:
setSelectMode(selectMode)
Set selection mode.
Parameters:
Name | Type | Description |
---|---|---|
selectMode |
String | one of: |
- Source: