I do want the dragged items inserted into the DP, I just want to add a
function call to the end of that which inserts the new row into a
local database table. My problem is that the for-loop which checks for
duplicate entries and merely prevents the default event and updates a
value in the DP makes it difficult to do what I want without doing it
for every row in the DP. Here's what I have thus far:

private function dragToOrders(event:DragEvent):void
{
var draggedItems:Object = new Object();
draggedItems = event.dragSource.dataForFormat("items");
var n:int = orderDetailArray.length;
for (var i:int = 0; i < n; i++)//Looping through to check for
duplicate entries
{
if (orderDetailArray[i].UniqueID == draggedItems[0].UniqueID)
{
orderDetailArray[i].Qty ++;
event.preventDefault();
adgOrders.dataProvider.dispatchEvent(new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
trace("Update fired");//Placeholder foractual update
function
return;
}
adgOrders.dataProvider.dispatchEvent(new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
trace("Insert fired"); //Placeholder for actual insert
function
}
}

Works well and perfect for just putting new items into the data
provider and updating current ones, but while I can update items in
the both the DP and the database just fine, I just can't figure out
where to put the function call to my insert function to put a new row
in the DB. So basically I figured early Friday was to see if it was
possible to modify the default event ever so slightly, to call the
insertToDataBaseFunction(); right after the normal behavior of
inserting it into the dataProvider.

Looks simple, problem is, I'm just not sure where to start.

--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> IIRC, the DragDrop event is the right place and you were already doing
> that.  If you don't preventDefault that event, it will insert the
> dragged items into the DP.  I haven't been paying close attention so I'm
> not clear what problem you ran into that makes you think this isn't the
> way to go.
> 
>  


Reply via email to