Interface IListDataSource

Provides access to a data source and enables you to bind, change, add, remove, and move items in that data source.

Index

Methods

Methods

public beginEdits()

Notifies the IListDataSource that a sequence of edits is about to begin. The IListDataSource will defer notifications until endEdits is called.

public change(key: string, newData: T in WinJS.UI.IListDataSource<T>): Promise

Overwrites the data of the specified item.

Parameters

  • key: string

    The key for the item to replace.

  • newData: T in WinJS.UI.IListDataSource<T>

    The new data for the item.

Returns

Promise

A Promise that contains the IItem that was updated or an EditError if an error was encountered.

public createListBinding(notificationHandler?: IListNotificationHandler): IListBinding

Creates an IListBinding that can retrieve items from the IListDataSource, enumerate the contents of the IListDataSource object's data, and optionally register for change notifications.

Parameters

  • notificationHandler?: IListNotificationHandler optional

    Enables the IListBinding to register for change notifications for individual items obtained from the IListDataSource. If you omit this parameter, change notifications won't be available.

Returns

IListBinding

The new IListBinding.

public endEdits()

Notifies the IListDataSource that the batch of edits that began with the last beginEdits call has completed. The IListDataSource will submit notifications for any changes that occurred between the beginEdits and endEdits calls as a batch and resume normal change notifications.

public getCount(): Promise

Retrieves the number of items in the data source.

Returns

Promise

A Promise that provides a Number that is the number of items in the data source.

public insertAfter(key: string, data: T in WinJS.UI.IListDataSource<T>, previousKey: string): Promise

Inserts a new item after another item.

Parameters

  • key: string

    The key that can be used to retrieve the new item, if known.

  • data: T in WinJS.UI.IListDataSource<T>

    The data for the item to add.

  • previousKey: string

    The key for an item in the data source. The new item will be added after this item.

Returns

Promise

A Promise that contains the IItem that was added or an EditError if an error was encountered.

public insertAtEnd(key: string, data: T in WinJS.UI.IListDataSource<T>): Promise

Adds an item to the end of the data source.

Parameters

  • key: string

    The key that can be used to retrieve the new item, if known.

  • data: T in WinJS.UI.IListDataSource<T>

    The data for the item to add.

Returns

Promise

A Promise that contains the IItem that was added or an EditError if an error was encountered.

public insertAtStart(key: string, data: T in WinJS.UI.IListDataSource<T>): Promise

Adds an item to the beginning of the data source.

Parameters

  • key: string

    The key that can be used to retrieve the new item, if known.

  • data: T in WinJS.UI.IListDataSource<T>

    The data for the item to add.

Returns

Promise

A Promise that contains the IItem that was added or an EditError if an error was encountered.

public insertBefore(key: string, data: T in WinJS.UI.IListDataSource<T>, nextKey: string): Promise

Inserts an item before another item.

Parameters

  • key: string

    The key that can be used to retrieve the new item, if known.

  • data: T in WinJS.UI.IListDataSource<T>

    The data for the item to add.

  • nextKey: string

    The key of an item in the data source. The new item will be inserted before this item.

Returns

Promise

A Promise that contains the IItem that was added or an EditError if an error was encountered.

public invalidateAll(): Promise

Indicates that all previous data obtained from the IListDataAdapter is invalid and should be refreshed.

Returns

Promise

A Promise that completes when the data has been completely refreshed and all notifications have been sent.

public itemFromDescription(description: any): Promise

Retrieves the item that has the specified description.

Parameters

  • description: any

    Domain-specific information, to be interpreted by the IListDataAdapter, that describes the item to retrieve.

Returns

Promise

A Promise that provides an IItem that contains the requested item or a FetchError if an error was encountered. If the item wasn't found, the promise completes with a value of null.

public itemFromIndex(index: number): Promise

Retrieves the item at the specified index.

Parameters

  • index: number

    A value that is greater than or equal to zero that is the index of the item to retrieve.

Returns

Promise

A Promise that provides an IItem that contains the requested item or a FetchError if an error was encountered. If the item wasn't found, the promise completes with a value of null.

public itemFromKey(key: string, description?: any): Promise

Retrieves the item with the specified key.

Parameters

  • key: string

    The key of the item to retrieve. It must be a non-empty string.

  • description?: any optional

    Domain-specific information that IListDataAdapter can use to improve the retrieval time.

Returns

Promise

A Promise that provides an IItem that contains the requested item or a FetchError if an error was encountered. If the item was not found, the promise completes with a null value.

public moveAfter(key: string, previousKey: string): Promise

Moves an item to just after another item.

Parameters

  • key: string

    The key that identifies the item to move.

  • previousKey: string

    The key of another item in the data source. The item specified by the key parameter will be moved after this item.

Returns

Promise

A Promise that contains the IItem that was moved or an EditError if an error was encountered.

public moveBefore(key: string, nextKey: string): Promise

Moves an item before another item.

Parameters

  • key: string

    The key that identifies the item to move.

  • nextKey: string

    The key of another item in the data source. The item specified by the key parameter will be moved before this item.

Returns

Promise

A Promise that contains the IItem that was moved or an EditError if an error was encountered.

public moveToEnd(key: string): Promise

Moves an item to the end of the data source.

Parameters

  • key: string

    The key that identifies the item to move.

Returns

Promise

A Promise that contains the IItem that was moved or an EditError if an error was encountered.

public moveToStart(key: string): Promise

Moves the specified item to the beginning of the data source.

Parameters

  • key: string

    The key that identifies the item to move.

Returns

Promise

A Promise that contains the IItem that was moved or an EditError if an error was encountered.

public remove(key: string): Promise

Removes the specified item from the data source.

Parameters

  • key: string

    The key that identifies the item to remove.

Returns

Promise

A Promise that contains nothing if the operation was successful or an EditError if an error was encountered.

public statuschanged(eventInfo: CustomEvent)

Occurs when the status of the IListDataSource changes.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event. The detail property of this object contains the following sub-properties: status.