I'm working on drag-and-drop capabilities between a tree and a datagrid. The dataProvider of the tree is XML and the dataProvider of the dataGrid is an arrayCollection. I have it fully working when moving a single item from one to the other, but allowing multiple selections is failing.
When the elements moved are leaf nodes, the following is called:
var items:Array = new Array();
if(event.dragSource.hasFormat("treeItems")) {
items = items.concat(event.dragSource.dataForFormat("treeItems") as Array);
}
for each(var item:Object in items) {
trashGrid.addItem({'kind':String(item.kind),'label':String(item.label)});
}
When going from the dataGrid to the tree, the above code works (items instead of treeItems), but when going from tree to dataGrid, this completely fails. However, I do know that items:int is equal to the number of items I'm trying to drag across. Can someone help me correct this?