Hi, I have a Combobox which contains 3 items (id : 1,2,3). I can select them via the mouse. By default, my combobox is on blank field (no item selected). When I want to change its value via a button (setValue(1) ,for example), my ComboBox doesn’t update !
I don’t understand this behavior ! Someone can help me ?
Can you post a minimal code sample?
[code]
public void construireListeExecutions(List executions) {
//On remet le composant à zéro
listeDeroulanteExecutions.removeAllItems();
listeDeroulanteExecutions.setNullSelectionAllowed(false);
//Pour chaque execution, creation d'un item dans la liste
for (Execution execution : executions) {
listeDeroulanteExecutions.addItem(execution.getId());
listeDeroulanteExecutions.setItemCaption(execution.getId(), execution.getNom());
}
System.out.println("before "+listeDeroulanteExecutions.getValue());
listeDeroulanteExecutions.setValue(2);
System.out.println("after "+listeDeroulanteExecutions.getValue());
}
[/code]Anyway, when I make a SetValue(), in reality, the value doesn’t change…
Resultat :
before 1
after 1
Ok, what does execution.getId() return (Which type)?
Because basically, this should work.
Thanks for quick answer !
But I resolved my problem. My Ids on my combobox are Long, not Integer… So I replace 2 to 2L and it works correctly !
thanks Tom have a good day