flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark goldin <markzolo...@gmail.com>
Subject Combo box and binding
Date Mon, 18 Nov 2013 16:57:23 GMT
BindingUtils.bindProperty(combobox, "comboValue", model, "field", true);

Here is my relative combobox code:
private var _comboValue:*;
public function set comboValue(value:*):void
{
 // simplified
for each (var listItem:* in dataProvider){ if (listItem.value] ==
_comboValue){ selectedItem = listItem; break; } }
}
[Bindable]
public function get comboValue():*
{
return _comboValue;
}
addEventListener(IndexChangeEvent.CHANGING, onChange, false, 0, true);

private function onChange(event:IndexChangeEvent):void
{
   if (selectedIndex > -1)
     comboValue = selectedItem.value;
   else  // new item
   {
        var _item:Object = new Object();
_item.value = textInput.text;
comboValue = _item.value;
ArrayCollection(dataProvider).addItemAt(_item, 0);
   }
}

When I add a new item the underlying model is not getting the new value and
I have to manually assign to it:
model.field = combobox.selectedItem["value"];

Any idea?

Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message