JavaScript

A5.ListBoxindexFromElement Method

Syntax

A5.ListBox.indexFromElement(element)

Arguments

elementelement

An element in the list.

Returns

indexnumber

The list row index that contains the given element. A value of -1 will be returned if the element is not in a list row.

Description

Get the index of the list row that contains the passed in element.

Example

// To get a pointer to the A5.ListBox class see {dialog.object}.getControl
// assume lObj is a pointer to an instance of the A5.ListBox class
// and that "ele" is an element in a list row
var indx = lObj.indexFromElement(ele); // "indx" will equal a number representing the "renderIndex" of the element

Example: Get the Index for an Element in a List Control 

The example below demonstrates how to get the index for an element in a List Control in a UX Component.

var listObj = {dialog.object}.getControl('list1');

//assume ele is a pointer to some element in the List row
var index = listObj.indexFromElement(ele);

See Also