List typed field usage - imona/tutorial GitHub Wiki

You can add a List to a form by right clicking and selecting "Add List". In order to select a List Item by its key, you can use selectByKey(constant_key) method. The same method can also be used on List typed fields which are rendered as combo box, list select or radio button group.

getComponent("cg_combo_1").selectByKey("item_1");  

In order to select the same item that is selected in list_field_1 in list_field_2, the following code snippet may be used:

getComponent("list_field_2").value = getComponent("list_field_1").value;  

In order to check if a certain item is selected, key of a ListItem can be used. Such usage is examplified below:

if (getComponent("city_field").value.key == "06") {
    warn("Selected city is: Ankara");
}  

For List typed fields that are rendered as twin column select or checkbox group, usage is as follows:

getComponent("list_field_3").selectByKey(["item1", "item2"]);  

Combobox Selected Item's Caption (Entity combobox, List combobox, transient combobox)

getComponent('comboboxName').captionForSelectedItem;  

Caption of a List item can be retrieved by invoking captionForListItem method:

captionForListItem(getComponent("city_field").value);  

Querying an enity with List on it;

var listofitems = "from entityname e where e.listtypefield.key = " + filtercode;  

Setting value of List item :

` obj.list_item_filed = entityUtils().query("from list_name where key = 'key1'" ).get(0);`