1 Reply Latest reply on Jan 13, 2009 4:37 AM by nikos101

    itemFocusOut called twice when you are using datagrid

    nikos101 Level 2
      Have you ever encountered itemFocusOut called twice when you are using datagrid. I use this event to check the text that has been entered.

      Also when I use regex expressions

      if((event.itemRenderer as TextInput).text.search(new RegExp(/.*\..*\./)) != -1){

      in the itemFocusOut method and someone enters

      234.34.234

      I get an error

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.controls::DataGrid/destroyItemEditor()[C:\autobuild\3.2.0\frameworks\projects\framewor k\src\mx\controls\DataGrid.as:4000]
      at mx.controls::DataGrid/itemEditorItemEditEndHandler()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\controls\DataGrid.as:4897]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9298]
      at mx.controls::DataGrid/endEdit()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\c ontrols\DataGrid.as:4041]
      at mx.controls::DataGrid/mouseDownHandler()[C:\autobuild\3.2.0\frameworks\projects\framework \src\mx\controls\DataGrid.as:4296]

      Could some be so kind as shed some light on this situation
        • 1. Re: itemFocusOut called twice when you are using datagrid
          nikos101 Level 2
          I've worked around the error. I had something to do with the fact that the event was being twice and I worked my handling code around to avoid the error. However the problem with the event still remains. I think it is because the data it in the grid is being refreshed intentially after the code in the itemFocusOut is called that is cause the second event to fire.