/ LJCJSCodeDoc / LJCCollectionLib / LJCCollection / GetIndex


Parameters
dataColumns - The unique data names and values.

Returns

The index of the matching collection item.

Syntax

JavaScript
GetIndex(dataColumns)

Gets the index of the object which matches the data values.

Example

JavaScript
// Gets the index of the object which matches the data values.
GetIndex()
{
  const testItems = new TestItems();
  let testItem = testItems.Add("NameOne");
  testItem.Sequence = 1;
  testItem = testItems.Add("NameTwo");
  testItem.Sequence = 2;

  const dataColumns = new LJCDataColumns();
  dataColumns.AddValue("Name", "NameTwo");
  const result = testItems.GetIndex(dataColumns);
  
  // result:
  // 1
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.