:: Forum >>
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
Wednesday, April 9, 2008
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)
Wednesday, April 9, 2008
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
Thursday, April 10, 2008
Use getItemText() method -
var i = 0;
combo.setSelectedItems([i]);
combo.setControlText(combo.getItemText(i));
Alex (ActiveWidgets)
Thursday, April 10, 2008
This topic is archived.
Back to support forum
Forum search