DataBoundScrollView
Extends:
A FlexScrollView with enhanced functionality for maintaining a two-way connection with a PrioritisedArray.
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) Be sure to specifiy either a getSize function in the class of the itemTemplate, or to specify the size in the layoutOptions. |
Method Summary
Public Methods | ||
public |
Clears the dataSource by removing all entries |
|
public |
getDataStore(): * Gets the currently set dataStore. |
|
public |
Returns the currently active group elements, or an empty object of none are present. |
|
public |
Determines whether the last element showing is the actual last element |
|
public |
reloadFilter(newFilter: Function, reRender: Boolean): Promise Reloads the dataFilter option of the DataBoundScrollView, and verifies whether the items in the dataStore are allowed by the new filter. |
|
public |
setDataStore(dataStore: *) Sets the datastore to use. |
|
public |
setGroupTemplate(templateFunction: *, reRender: *) Sets a group template function, optionally re-renders all the dataSource' renderables. |
|
public |
setItemTemplate(templateFunction: *) Set a template function, optionally re-renders all the dataSource' renderables |
Public Constructors
public constructor(options: Object) source
Be sure to specifiy either a getSize function in the class of the itemTemplate, or to specify the size in the layoutOptions.
Override:
ReflowingScrollView#constructorParams:
Name | Type | Attribute | Description |
options | Object | The options passed inherit from previous classes. Avoid using the dataSource option since the DataBoundScrollView creates its own dataSource from options.dataStore. |
|
options.dataStore | PrioriisedArray |
|
The data that should be read to create entries. |
options.itemTemplate | Function |
|
A function that returns a renderable representing each data item. |
options.placeholderTemplate | Function |
|
A function that returns a renderable to display when there are no items present. |
options.headerTemplate | Function |
|
A function that returns a renderable to display as a header. |
options.orderBy | Function |
|
An ordering function that takes two data models (model1, model2). If it returns true, then model1 should go before model2. |
options.groupBy | Function |
|
A function that takes a model and returns a value to group by. If set, then the groupTemplate option also needs to be set. |
options.groupTemplate | Function |
|
A function that takes as a single argument the groupBy value and returns a renderable to insert before a group belonging to that value. |
options.stickHeaders | Boolean |
|
If set to true, then the group headers will stick to the top when scrolling. Beware that this is slightly buggy as of now and might require some fine tuning to provide a better UX. |
options.customInsertSpec | Function |
|
A function that takes as a single argument a model and returns a spec that is used when inserting a new item. |
options.chatScrolling | Boolean |
|
If set to true, the scroll will remain at the bottom if at bottom already when new messages are added. If this function returns true, then model1 will be placed before model2. |
Public Methods
public getGroups(): Object source
Returns the currently active group elements, or an empty object of none are present.
public isAtBottom(): boolean source
Determines whether the last element showing is the actual last element
public reloadFilter(newFilter: Function, reRender: Boolean): Promise source
Reloads the dataFilter option of the DataBoundScrollView, and verifies whether the items in the dataStore are allowed by the new filter. It removes any currently visible items that aren't allowed anymore, and adds any non-visible ones that are allowed now.
public setDataStore(dataStore: *) source
Sets the datastore to use. This will repopulate the view and remove any (if present) old items.
Params:
Name | Type | Attribute | Description |
dataStore | * |
public setGroupTemplate(templateFunction: *, reRender: *) source
Sets a group template function, optionally re-renders all the dataSource' renderables.
Params:
Name | Type | Attribute | Description |
templateFunction | * | ||
reRender | * |
public setItemTemplate(templateFunction: *) source
Set a template function, optionally re-renders all the dataSource' renderables
Params:
Name | Type | Attribute | Description |
templateFunction | * |