1 Reply Latest reply on Nov 18, 2007 3:55 PM by goldman-x

    itemEditEnd not firing in DataGrid

      In one particular DataGrid it's not firing - all other in my app work fine. I've had another Flex developer to look at my code just in case I'm going mad or something, and he thinks it's a bug in Flex framework somewhere. I'm using Flex Builder 2.0.1 FWIW

      Here is isolated code that exhibits the same behaviour (breakpoint in onEdit event listener func does not trigger). Much of it may seem superfluous but in actual app it's neccessary in the actual app (I just tried to isolate the cause!).

      Any ideas?


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      xmlns:mx=" http://www.adobe.com/2006/mxml"
      width="100%" height="100%" id="ccc"
      paddingTop="0" paddingLeft="0" paddingRight="0"
      import mx.events.DataGridEvent;
      import mx.events.DataGridEventReason;
      import mx.collections.ArrayCollection;

      // Dataprovider
      private var _dp:ArrayCollection;

      // This will contain array (hash) accessible by bottombar or somesync
      public var bottomBar:Array;

      public function onInit():void
      _dp=new ArrayCollection([{PK: 'Matt', label: "XXX", col1: 'Matthews', col2: 'XEXE', level: 1}]);;


      public function refresh():void
      // TODO: check if entity ID and other props are not blank!
      // Refresh contents or somesync

      // Callback function - when the data arrives
      protected function onData(result:Array):void
      // Builds our dataprovider or somesync
      var tmpDPRow:Array;
      var _bottomBar:Array=new Array();
      _dp=new ArrayCollection();

      for ( var j:String in result ) {
      // First, check level. If 0 this row belongs to bottombar
      if ( result[j]["level"] == "0" ) {
      var pk:String=result[j]["PK"];
      pk=pk.replace("-","_"); // - is not valid in object ID, so we replace with _
      _bottomBar[pk]=new Object();
      } else {
      // Go over fields
      tmpDPRow=new Array();

      // Apply bottom bar
      // Apply all data to datagrid


      public function onEdit(event:DataGridEvent):void {

      trace ('fire in the whole!');
      if ( event.reason == DataGridEventReason.CANCELLED ) {

      // MUST URGENTLY UPDATE frickin database!
      this.refresh(); // Subtotals have changed - need refresh

      Note the hack below: column widths are absurdly large values
      The idea is that Flex will resize down and keep the proportions
      <mx:DataGrid xmlns:mx=" http://www.adobe.com/2006/mxml"
      width="100%" height="100%" showHeaders="false" itemEditEnd="onEdit(event)" id="entrygrid">
      <mx:DataGridColumn width="0" visible="false" dataField="PK">
      <mx:DataGridColumn width="70000" itemRenderer="mx.controls.TextInput" editable="false" dataField="label">
      <mx:DataGridColumn width="15000" itemRenderer="mx.controls.TextInput" editable="false" dataField="col1">
      <mx:DataGridColumn width="15000" itemRenderer="mx.controls.TextInput" rendererIsEditor="true" editable="true" dataField="col2">