1 Reply Latest reply on Jan 9, 2007 9:57 AM by TucsonJava

    _editedItemPosition exception

    TucsonJava Level 1
      I upgraded to 2.0.1 a day ago and found that I now get an exception whereas with version 2.0.0 it worked as expected. It happens on adding a new row to a datagrid.

      Code for adding new row is:
      var oi:PurchaseOrderItem = new PurchaseOrderItem();
      oi.product.description = "Enter some data";
      oi.amountOrdered = 1;
      purchaseOrderDetails.addItemAt(oi,purchaseOrderDetails.length);
      dg_purchaseOrderItems.selectedIndex = purchaseOrderDetails.length-1;
      // set the focus into the Description column of the selected row
      var eip:Object = {columnIndex:1, rowIndex:dg_purchaseOrderItems.selectedIndex};
      dg_purchaseOrderItems.editedItemPosition=eip;

      Exception is:
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.controls::DataGrid/mx.controls:DataGrid::itemEditorItemEditBeginHandler()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\controls\DataGrid.as:4741]
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\core\UIComponent.as:8323]
      at mx.controls::DataGrid/mx.controls:DataGrid::commitEditedItemPosition()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\controls\DataGrid.as:3358]
      at mx.controls::DataGrid/mx.controls:DataGrid::updateDisplayList()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\controls\DataGrid.as:1239]
      at mx.core::UIComponent/validateDisplayList()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\core\UIComponent.as:5760]
      at mx.managers::LayoutManager/mx.managers:LayoutManager::validateDisplayList()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\managers\LayoutManager.as:600]
      at mx.managers::LayoutManager/mx.managers:LayoutManager::doPhasedInstantiation()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\managers\LayoutManager.as:673]
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher2()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\core\UIComponent.as:7909]
      at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher()[C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\frameworks\source\mx\core\UIComponent.as:7852]

      The exception is because _editedItemPosition is null when referenced.

      I tried moving the adding of a row out to a separate method and using callLater to invoke. However, there was no change in behavior.

      Adobe team, do you have any idea of why this exception would be occurring now?
      Text
        • 1. Re: _editedItemPosition exception
          TucsonJava Level 1
          OK, essentially you can ignore the previous post. I found out the the problem is with a 3rd party component I am using. However, something in 2.0.1 is functioning differently since the 3rd party component used to work correctly.

          All the other itemEditors and itemRenders in the application work as expected.