8.8 released—CSS Media Query support, SF Symbols and much more...
Learn more
ListView
Represents a view that shows items in a vertically scrolling list.

Summary

Constructors

constructor

Properties

android
ios
iosEstimatedRowHeight
itemIdGenerator
itemLoadingEvent
items
itemTapEvent
itemTemplate
itemTemplates
itemTemplateSelector
loadMoreItemsEvent
rowHeight
separatorColor
152 properties inherited from View
Click to expand

Methods

isItemAtIndexVisible
on
refresh
scrollToIndex
scrollToIndexAnimated
111 methods inherited from View
Click to expand

Constructors

constructor

new ListView(): ListView

Properties

android

android: any
Gets the native [android widget](http://developer.android.com/reference/android/widget/ListView.html) that represents the user interface for this component. Valid only when running on Android OS.

ios

ios: any
Gets the native [iOS view](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/) that represents the user interface for this component. Valid only when running on iOS.

iosEstimatedRowHeight

iosEstimatedRowHeight: LengthType
Gets or set the estimated height of rows in the ListView. The default value is 44px.

itemIdGenerator

itemIdGenerator: (item: any, index: number, items: any) => number

itemTemplate

itemTemplate: string | Template
Gets or set the item template of the ListView.

itemTemplateSelector

itemTemplateSelector: string | (item: any, index: number, items: any) => string
A function that returns the appropriate ket template based on the data item.

itemTemplates

itemTemplates: string | KeyedTemplate[]
Gets or set the list of item templates for the item template selector

items

items: any[] | ItemsSource
Gets or set the items collection of the ListView. The items property can be set to an array or an object defining length and getItem(index) method.

rowHeight

rowHeight: LengthType
Gets or set row height of the ListView.

separatorColor

separatorColor: Color
Gets or set the items separator line color of the ListView.

itemLoadingEvent

Static
itemLoadingEvent: string
String value used when hooking to itemLoading event.

itemTapEvent

Static
itemTapEvent: string
String value used when hooking to itemTap event.

loadMoreItemsEvent

Static
loadMoreItemsEvent: string
String value used when hooking to loadMoreItems event.

Methods

isItemAtIndexVisible

isItemAtIndexVisible(index: number): boolean
Checks if Specified item with index is visible.
Parameter Default Description
index
number

Item index.

Returns boolean

on

on(eventNames: string, callback: (data: EventData) => void, thisArg?: any): void
A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
Parameter Default Description
eventNames
string

String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").

callback
(data: EventData) => void

Callback function which will be executed when event is raised.

thisArg
any

An optional parameter which will be used as `this` context for callback execution.

Returns void
on(event: "itemLoading", callback: (args: ItemEventData) => void, thisArg?: any): void
Raised when a View for the data at the specified index should be created. The result should be returned trough the view property of the event data. Note, that the view property of the event data can be pre-initialized with an old instance of a view, so that it can be reused.
Parameter Default Description
event
"itemLoading"

callback
(args: ItemEventData) => void

thisArg
any

Returns void
on(event: "itemTap", callback: (args: ItemEventData) => void, thisArg?: any): void
Raised when an item inside the ListView is tapped.
Parameter Default Description
event
"itemTap"

callback
(args: ItemEventData) => void

thisArg
any

Returns void
on(event: "loadMoreItems", callback: (args: EventData) => void, thisArg?: any): void
Raised when the ListView is scrolled so that its last item is visible.
Parameter Default Description
event
"loadMoreItems"

callback
(args: EventData) => void

thisArg
any

Returns void

refresh

refresh(): any
Forces the ListView to reload all its items.
Returns any

scrollToIndex

scrollToIndex(index: number): any
Scrolls the specified item with index into view. [iOS](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITableView_Class/#//apple_ref/occ/instm/UITableView/scrollToRowAtIndexPath:atScrollPosition:animated:) [Android](http://developer.android.com/reference/android/widget/ListView.html#setSelection(int))
Parameter Default Description
index
number

Item index.

Returns any

scrollToIndexAnimated

scrollToIndexAnimated(index: number): any
Scrolls the specified item with index into view with animation. [iOS](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITableView_Class/#//apple_ref/occ/instm/UITableView/scrollToRowAtIndexPath:atScrollPosition:animated:) [Android](https://developer.android.com/reference/android/widget/ListView.html#smoothScrollToPosition(int))
Parameter Default Description
index
number

Item index.

Returns any
Previous
ListPicker