3.2.0

How to selecte an item by index of Combo?

Please advise me how to selecte an item by index of Combo. I tried:

combo.setSelectedItems([0]); and combo.setItemSelected(0);

They don't work. It must be a common knowledge. However, I couldn't find any reference in online document.

Thanks,
mrhsh
April 9,
This code is correct -

combo.setSelectedItems([0]);


However you should also add some CSS to actually make the selection visible -

.aw-frame-template .aw-items-selected {
    color: #fff;
    background: #316ac5;
}
Alex (ActiveWidgets)
April 9,
Thanks for your help! I tried to add CSS as your suggestion. The item in the dropdown list is marked. However, the combo is still blank. I like to select an item by program just as mannual selecting. I tried:

combo.setSelectedItems([0]);
combo.setControlText(combo.getSelectedItems([0]));

The combo is still blank after execute this code.
mrhsh
April 10,
Use getItemText() method -

var i = 0;
combo.setSelectedItems([i]);
combo.setControlText(combo.getItemText(i));
Alex (ActiveWidgets)
April 10,

This topic is archived.

See also:


Back to support forum