ComboBox.select(Object itemId) not updating ComboBox selection

Hi,

I have a form which I use to create new items for a Table. Several properties are handled by ComboBoxes.

I’m now trying to reuse this form to edit existing items. What I did was create a new constructor for the form Window object, which receives the Item that should be edited. In this constructor, I run through the same steps as the regular, no arguments constructor, and as a last step I try to set up the ComboBox selections like this:

// i is the item that was received as parameter
property1Combo.select(i.getItemProperty("id_property1").getValue());
property2Combo.select(i.getItemProperty("id_property2").getValue());
property3Combo.setValue(i.getItemProperty("id_property3").getValue());

I tried setValue but that doesn’t work either (and debugger shows the value stays in null). Also by debugger I saw that the combos are properly filled (have the items I expect it to, with the IDs that are returned by i.getItemProperty().getValue()). I even tried using markAsDirty() but that doesn’t work either. All input widgets are marked immediate. Using setValue on the other fields that are text-based worked as expected. So did the date pickers. The ComboBoxes are the ones refusing to update with select().

What am I missing? Where would you suggest I look?

Thanks in advance,
Javier

Hi Javier,

The value of the ComboBox is the item id of the selected item. Now you are trying to set value of a property to ComboBox.

Hi Jarno,

thank you! Now that you mention it, it’s blindingly obvious (facepalm moment indeed). Rewrote the code to walk the items comparing the values to find the corresponding Combo Item id and now the application behaves as expected (they’re small combos so it’s not a big performance hit).

Thanks again,
Javier