views:

313

answers:

1

OK I have an AdvancedDataGrid. The data I feed it is XML that looks like this:

<stat associate="Sam Smith" date="07/08/09" customer="James Frank"/>
<stat associate="John Doe" date="09-07-08" customer ="Amanda Jones"/>
<stat associate="John Doe" date="09-07-09" customer ="Henry Scott"/>

But I am grouping by associate so it ends up looking like a tree like this:

Sam Smith
07/08/09    James Frank

John Doe
09-07-08    Amanda Jones
09-07-09    Henry Scott

I am trying to make it so you can re-assign customers to different associates by dragging them from one to another. I set dragMoveEnabled so I can actually click on and move it to another associate and it visually works perfect. But I need to detect who received what so I can update the data-base with the change.

Does anyone know how to do that?

Thanks!!

UPDATE: I tried looking at the flat data afterwards like so:

public function onDragComplete(event:Event):void 
{ 
    var adg:AdvancedDataGrid = AdvancedDataGrid(event.currentTarget);
    var hcv:HierarchicalCollectionView = HierarchicalCollectionView(adg.dataProvider);
    var gc:GroupingCollection = GroupingCollection(hcv.source);
    trace(gc.source);
}

And it has not changed, maybe the non-flat data changes tho, but I am not sure how to view the non-flat data?

A: 

I believe changes to datagrid should change the underlying dataProvider. You can listen to changes to the dataProvider (Eg, the PropertyChanged event for ArrayCollections), and then send the server the change.

CookieOfFortune
Thanks for your comment, I viewed the flat data afterwards and it doesn't change. I added another code sample to my question to show how I checked it. Maybe if I could view the non-flat data...not sure how to tho?
John Isaacks
Hmmm... you might need to iterate through the nodes and display the data that way. Otherwise it might just list the data flat.
CookieOfFortune