SelectListView
A scrollable list view for displaying selectable items in dropdown controls.
SelectListView provides a virtualized list interface for selecting from a collection of string options. It supports highlighting the current selection, null value handling, and automatic scrolling to selected items. The view uses a CollectionView for efficient rendering of large lists.
Key features:
- Virtualized scrolling for performance with large lists
- Current selection highlighting
- Support for null values with custom display text
- Click and touch interaction
- Automatic scrolling to selected items
- Customizable cell styling through themes
Usage example:
var listView = new SelectListView();
listView.list = ['Item 1', 'Item 2', 'Item 3'];
listView.nullValueText = 'None';
listView.value = 'Item 2';
listView.size(200, 150);
listView.onValueChange(this, (value, prev) -> {
trace('Selected: ' + value);
});
add(listView);
Static Members
Height of each item in the list in pixels
Instance Members
Default is false
, automatically set to true
when any of this instance's observable variables has changed.
Custom theme override for this list view. If null, uses the global context theme
Whether to automatically scroll to the selected value when it changes
The currently selected value. Can be null if no value is selected
Array of string options to display in the list
Text to display for the null/empty value option. If null, no null option is shown
Scrolls the list to show the currently selected value.
Name | Type | Description |
---|---|---|
position |
ceramic.CollectionViewItemPosition | How to position the item (START, CENTER, END, ENSURE_VISIBLE) |
Returns the total number of items in the list.
Includes an extra item if nullValueText is set to represent the null option.
Name | Type | Description |
---|---|---|
collectionView |
ceramic.CollectionView | The collection view requesting the size |
Returns | Description |
---|---|
Int | Total number of items including null option if applicable |
collectionViewItemFrameAtIndex(collectionView: ceramic.CollectionView, itemIndex: Int, frame: ceramic.CollectionViewItemFrame): Void
Provides the frame (size and position) for an item at the given index.
All items have the same height (ITEM_HEIGHT) and fill the collection view width.
Name | Type | Description |
---|---|---|
collectionView |
ceramic.CollectionView | The collection view requesting the frame |
itemIndex |
Int | Index of the item |
frame |
ceramic.CollectionViewItemFrame | Frame object to populate with size information |
collectionViewReleaseItemAtIndex(collectionView: ceramic.CollectionView, itemIndex: Int, view: ceramic.View): Bool
Called when a view is no longer needed at the given index.
Allows cleanup before view reuse. For SelectListView, cells can always be reused.
Name | Type | Description |
---|---|---|
collectionView |
ceramic.CollectionView | The collection view releasing the item |
itemIndex |
Int | Index of the item being released |
view |
ceramic.View | The view being released |
Returns | Description |
---|---|
Bool | true if the view can be reused, false otherwise |
collectionViewItemAtIndex(collectionView: ceramic.CollectionView, itemIndex: Int, reusableView: ceramic.View): ceramic.View
Creates or reuses a view for the item at the given index.
Creates CellView instances to display list items. Reuses existing views when possible for performance. Binds cell data and interaction handlers.
Name | Type | Description |
---|---|---|
collectionView |
ceramic.CollectionView | The collection view requesting the item |
itemIndex |
Int | Index of the item |
reusableView |
ceramic.View | Existing view that can be recycled, if available |
Returns | Description |
---|---|
ceramic.View | The view to display for this item |
Creates a new SelectListView.
Sets up the collection view for virtualized scrolling, configures data binding, and initializes automatic scrolling behavior.
Private Members
The collection view that handles virtualized scrolling and cell management
Event when any observable value as changed on this instance.
Name | Type |
---|---|
instance |
SelectListView |
fromSerializedField |
Bool |
Event when theme field changes.
Name | Type |
---|---|
current |
Theme |
previous |
Theme |
Event emitted when a value is clicked/selected
Name | Type |
---|---|
value |
String |
Event when value field changes.
Name | Type |
---|---|
current |
String |
previous |
String |
emitListChange(current: ceramic.ReadOnlyArray<String>, previous: ceramic.ReadOnlyArray<String>): Void
Event when list field changes.
Name | Type |
---|---|
current |
ceramic.ReadOnlyArray<String> |
previous |
ceramic.ReadOnlyArray<String> |
Event when nullValueText field changes.
Name | Type |
---|---|
current |
String |
previous |
String |
Updates scroll position to show the current value if auto-scrolling is enabled.
This is called automatically when the value changes and autoScrollToValue is true.
Binds data and interaction handlers to a cell view.
Sets up automatic updates for cell content, selection state, and theme, and configures click handling for value selection.
Name | Type | Description |
---|---|---|
cell |
CellView | The cell view to bind |
Updates the visual style of the list view based on the current theme.
Sets the background color, border appearance, and other visual properties to match the current theme.
Metadata
Name | Parameters |
---|---|
:build |
tracker.macros.ObservableMacro.build() |
:autoBuild |
tracker.macros.ObservableMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |