Work with List

Setting focus on item

To set focus on a List item, make use of the setFocus method. It takes the id of an item as a parameter:

list.setFocus("7");

Related sample:  List. Set Active Index

To get the id of a List item in focus, use the getFocus method. It will return the id of an item in focus:

list.getFocus(); // -> "6"

Editing items

You can edit a particular List item with the help of the editItem method. It takes as a parameter the id of an item:

list.editItem("1");

Related sample:  List. Edit Items

Disabling and enabling selection of an item

For information on disabling/enabling selection of an item, read Enabling/Disabling Selection object.

Using Data Collection API

You can manipulate List items with the help of the Data collection API.

Adding items into List

It is possible to add more items into the initialized List on the fly. Use the add() method of Data Collection. It takes two parameters:


list.data.add({value:"New item"},1);

Related sample:  List. Add

Updating List items

You can change config options of the item via the update() method of Data Collection. It takes two parameters:

For example, you can change the value of an item:

list.data.update("option_id",{
    value:"Nice item"
});

Related sample:  List. Update

Removing items from List

To remove an item, make use of the remove() method of Data Collection. Pass the id of the item that should be removed to the method:

list.data.remove("option_id");

Related sample:  List. Delete

Filtering List data

You can filter List data by the specified criteria with the help of the filter method of Data collection. Check all details on parameters of the method in the Data collection API.

list.data.filter({
    by:"value",
    match:2,
    compare:(value,match,item)=>{ return parseFloat(value) % 2 == 0}
});

Related sample:  List. Filter

Filtering can be applied to any attribute of a data item.

Sorting List data

It is possible to sort data in List via the sort method of Data collection. Check all details on parameters of the method in the Data collection API.

list.data.sort({ 
    by:"value",
    dir:"desc"
});

Related sample:  List. Sort

Sorting can be applied to any attribute of a data item.

Using Selection API

For information on using Selection API, read Work with Selection Object.

Back to top