Slider.getItemByIndex

Syntax

getItemByIndex(index: Number);

Parameters

index. Index of the returned slider.

Description

The getItemByIndex method returns a slider of the Slider component by specified index.

Comments

The method returns value of the PP.Ui.SliderItem type.

Example

To execute the example, the page must contain the Slider component named slider (see Example of Creating the Slider Component). Get the slider with the index 0, show its identifier, get sorted array of sliders and show its length, get and show value of minimum possible number of sliders, get and show value of the label with the index 0:

// Get the slider with the index 0
var item = slider.getItemByIndex(0);
// Show the identifier of received slider
console.log("Identifier of the slider with index 0: " + item.getId());
// Get sorted array of sliders and show sliders number
console.log("Sliders number: " + slider.getSortedItems().length);
// Get and show value of minimum possible number of sliders
console.log("Minimum sliders number: " + slider.getMinItemsCount());
// Get and show value of the tag with the index 0
console.log("Value of the tag with the index [0]: " + slider.getTickByIndex(0));

After executing the example the browser console displays the following information: identifier of the slider with the index 0, current and minimum possible number of sliders, and value of the label with the index 0:

Identifier of the slider with the index 0: SliderItem1

Number of sliders: 2

Minimum number of sliders: 0

Value of label with the index [0]: 2001

See also:

 Slider