Ok, so the itemEditor = ComboBox with the above Override and here it is as it
stands and works (up to a point).
<mx:DataGridColumn headerText="Reason Stopped"
dataField="reason_med_stopped_oidCol"
editorDataField="selectedItem">
<mx:itemEditor>
<mx:Component>
<mx:ComboBox editable="true" labelField="label" >
<mx:ArrayCollection>
<mx:Object label="Patient Died"
data="130"/>
<mx:Object label="Maximum dosage"
data="131"/>
<mx:Object label="Consulting Decision"
data="132"/>
</mx:ArrayCollection>
<mx:Script>
<![CDATA[
import
mx.collections.IViewCursor;
override public function set
data(value:Object):void
{
super.data = value;
var
listCursor:IViewCursor = collection.createCursor();
do
{
if
(data.reason_med_stopped_oidCol ==
listCursor.current.data)
{
selectedItem =
listCursor.current;
break;
}
}
while
(listCursor.moveNext());
}
]]>
</mx:Script>
</mx:ComboBox>
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
Now this works perfectly now when I click in the Cell the ComboBox opens
with the selectedItem and when I select an option and exit the Cell the
DataGridEvent.ITEM_EDIT_END fires and I extract the data value to insert
into the parameters with
parameters[dsFieldName.substr(0,dsFieldName.length-3)] =
e.currentTarget.itemEditorInstance.selectedItem.data;
and that saves to the database, all great...however, the
editorDataField="selectedItem" puts "[object Object]" into the Grid instead
of the data element.
I tried editorDataField="selectedItem.data" but that fails. I tried "value"
and "text" but it saves the Label.
So what do I put in the editorDataField to save the 'data' to the Grid
instead of the object string or the label?
--
View this message in context:
http://www.nabble.com/itemRenderer-ComboBox-tp21243094p21255448.html
Sent from the FlexCoders mailing list archive at Nabble.com.