EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

ListLayout.itemInfo property

Applies to Windows only

This property is no longer supported. Starting with the Windows Library for JavaScript 2.0, use a CellSpanningLayout. Gets or sets a function that returns the width and height of an item, as well as whether it should appear in a new column. Setting this function improves performance because the ListView can allocate space for an item without having to measure it first.

Syntax


var itemInfo = listLayout.itemInfo;
listLayout.itemInfo = itemInfo;

Property value

Type: Function

A function that takes a single parameter:

itemIndex

The index of the item to render.

The function returns an object that contains these properties:

width

The total width of the item, which includes the item width, left and right padding, left and right border, and left and right margin.

height

The total height of the item, which includes the item height, top and bottom padding, top and bottom border, and top and bottom margin.

newColumn

Set to true to create a column break; otherwise, false.

Remarks

Note  

The values returned by the itemInfo function must be set based on the item index and can't reliably depend on item data.

Because the itemInfo function takes an index (and not an IItemPromise), it can’t wait for an item to be returned from the data source. This is fine for synchronous data sources, such as WinJS.Binding.List, because the item is readily available and can be looked up by index. It’s difficult, however, to look up data in an asynchronous data source based on the provided index value (itemIndex), because the items might be added out of order and the data for the items might not yet be available, so your itemInfo function can’t reliably perform a key-based lookup.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported

End of client support

Windows 8.1

End of phone support

None supported

End of server support

Windows Server 2012 R2

Namespace

WinJS.UI

Library

Ui.js

See also

ListLayout

 

 

Afficher:
© 2014 Microsoft