0 Replies Latest reply on Jan 16, 2011 12:25 AM by supergrobi007

    Drag & Drop Hierarchical Data (AdvancedDataGrid)




      Flex Sdk 4.1, but same problem with 3.5

      I have two ADGs displaying hierarchical objects (depth = 2). I have implemented drag and drop event handlers to manually copy the data from one ADG into the other. The dragDrop handler does the data copy and the dragEnter handler checks for duplicate entries and that no parent can be dropped. After the drop I get a runtime error at 'mx.controls::AdvancedDataGrid/addItemsToTarget()[E:\dev\4.x\frameworks\projects\datavisu alization\src\mx\controls\AdvancedDataGrid.as:6245]' saying that the code is trying to access a null-value object. Of course I set event.preventDefault() and the manually copying does work as well, but I have no clue were the error comes from.

      My workaround at the moment is to set dropEnabled to true, because here I get not runtime error. The automated copying from Flex adds a child node object to the datagrid which has not parent. My manually copying adds the correct child at the correct position with the correct parent. At the end of the dragDrop handler I add a function with callLater() and in this function I remove all child nodes with no parent (getParentItem() returns null) that come with the automated copying from Flex.


      Horrible workaround, but I found nothing better. I have browsed the several forums and the web and obviously people have some troubles with Drag & Drop of Hierarchical Data. I hope someone has any idea where the runtime error comes from.