Class: ListView

html.ListView

Class representing a list view or grid view fed from a ListModel.

new html.ListView ()

Properties:
Name Type Description
cacheMargin number

(default: 0) The size of the margin around the visible viewport that is kept in cache.

cellHeight number

(default: 32) The height of an item.

cellWidth number

(default: 64) The width of an item.

count number

[readonly] The amount of items.

delegate fengshui.Template

The delegate template for creating items dynamically.

model core.ListModel

The model to display. You may pass a number value to implicitly create a simple model.

orientation string

(default: vertical) The orientation of the view. One of horizontal|vertical

overflowBehavior string

(default: "scroll") The overflow behavior: none|scroll

rendering bool

[readonly] true while the list view is rendering.

scrollbars bool

(default: false) Whether to display native scrollbars.

snapMode bool

(default: "none") The mode for snapping to items. One of none|begin|end.

Extends

Methods

Returns the item with the given index number. This method may return null if the item is not materialized while not in view.

Name Type Description
idx number

The index number.

Returns:
Type Description
core.Object The item with the index number or null.

indexAt (x, y)number

Returns the index number of the item at the given content position.

Name Type Description
x number

The X coordinate.

y number

The Y coordinate.

Returns:
Type Description
number The index number at that coordinate.

positionOf (idx)Array.<number>

Returns the content coordinates of the item with the given index number.

Name Type Description
idx number

The item's index number.

Returns:
Type Description
Array.<number> A tuple of the X and Y coordinates.

positionViewAt (idx)

Positions the view at the given item.

Name Type Description
idx number

The index of the item.

Events

html.ListView.event:newLayout

Is triggered when the layout of items has changed.