0 Replies Latest reply on Sep 15, 2010 11:57 PM by Ibarim

    dataGrid itemEditor disappears after edit

    Ibarim Level 1

      Hi,

       

      I'm just getting to know item editors and I found strange behaviour. I got a custom itemEditor which is a comboBox. After choosing value form the combo and clicking somewhere else the whole combo disappears and I got empty dataGrid cell. Why is that? Should I do something on itemFocusOut event?

       

      Here is dataGrid:

       

      <mx:DataGrid id="dataGrid" dataProvider="{getData}" editable="false">

       

      And here is itemEditor:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml">
       <mx:ComboBox id="cb" labelField="name" width="100%" dataProvider="{parentDocument.getAllData}" editable="true"/>
       <mx:Script>
       <![CDATA[
       import mx.collections.ArrayCollection;
       
       override public function set data(value:Object):void {
       super.data = value;
       var arr:ArrayCollection = parentDocument.getAllData;
       for (var i:int;i<arr.length;i++) {
       if (data.id == arr[i].id) {
       cb.selectedIndex = i;
       break;
       }
       } 
       }
       
       ]]>
       </mx:Script>
      </mx:HBox>