Class ItemContainer

Defines an item that can be pressed, swiped, and dragged.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(element?: HTMLElement, options?: any): ItemContainer

Creates a new ItemContainer.

constructor

Parameters

  • element?: HTMLElement optional

    The DOM element hosts the new ItemContainer. For the ItemContainer to be accessible, this element must have its role attribute set to "list" or "listbox". If tapBehavior is set to none and selectionDisabled is true, then use the "list" role; otherwise, use the "listbox" role.

  • options?: any optional

    An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events.

Returns

ItemContainer

Properties

public draggable: boolean

Gets or sets a value that specifies whether the item can be dragged.

public element: HTMLElement

Gets the element that hosts this ItemContainer.

public selected: boolean

Gets or sets a value that specifies whether the item is selected.

public selectionDisabled: boolean

Gets or sets a value that specifies whether selection of this item is disabled.

public swipeBehavior: SwipeBehavior

Gets or sets how the ItemContainer reacts to the swipe gesture. The swipe gesture can select the swiped items or can have no effect on the current selection.

public swipeOrientation: Orientation

Gets or sets the orientation of swipe gestures.

public tapBehavior: TapBehavior

Gets or sets how the ItemContainer reacts when the user taps or clicks an item.

Methods

public addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean)

Registers an event handler for the specified event.

Parameters

  • eventName: string

    The name of the event to handle. Note that you drop the "on" when specifying the event name. For example, instead of specifying "onclick", you specify "click".

  • eventHandler: Function

    The event handler function to associate with the event.

  • useCapture?: boolean optional

    Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase.

public dispatchEvent(type: string, eventProperties: any): boolean

Raises an event of the specified type and with additional properties.

Parameters

  • type: string

    The type (name) of the event.

  • eventProperties: any

    The set of additional properties to be attached to the event object when the event is raised.

Returns

boolean

true if preventDefault was called on the event, otherwise false.

public dispose()

Releases resources held by this ItemContainer. Call this method when the ItemContainer is no longer needed. After calling this method, the ItemContainer becomes unusable.

public forceLayout()

Forces the ItemContainer to update its layout. Call this function when the reading direction of the app changes after the control has been initialized.

public oninvoked(eventInfo: CustomEvent)

Raised when the item is invoked. (You can use the tapBehavior property to specify whether taps and clicks invoke the item.)

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public onselectionchanged(eventInfo: CustomEvent)

Raised after the item is selected or deselected.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public onselectionchanging(eventInfo: CustomEvent)

Raised just before the current selection changes.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean)

Removes an event handler that the addEventListener method registered.

Parameters

  • eventName: string

    The name of the event that the event handler is registered for.

  • eventCallback: Function

    The event handler function to remove.

  • useCapture?: boolean optional

    Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler.