QueryCollection.template method

Applies to Windows and Windows Phone

Renders a template that is bound to the given data and parented to the elements included in the QueryCollection. If the QueryCollection contains multiple elements, the template is rendered multiple times, once at each element in the QueryCollection per item of data passed.

Syntax


var queryCollection = queryCollection.template(templateElement, data, renderDonePromiseCallback);

Parameters

templateElement

Type: DOMElement

The DOM element to which the template control is attached.

data

Type: Object

The data to render. If the data is an array (or any other object that has a forEach method) then the template is rendered multiple times, once for each item in the collection.

renderDonePromiseCallback

Type: Function

If supplied, this function is called each time the template gets rendered, and is passed a promise that is fulfilled when the template rendering is complete.

Return value

Type: QueryCollection

The QueryCollection.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1

Namespace

WinJS.Utilities

Library

Base.js

See also

QueryCollection

 

 

Show:
© 2014 Microsoft