I am attempting to allow a user to drag a document to 
a "favorites" grid. Upon the drag and drop I want to save all of the 
grid items currently in the grid back to a database. I'm not having 
any luck at all.
    The drop works fine, but saving the grid information to the 
database and subsequent refresh has been a problem.
    Could someone point me in the right direction? Thanks.

    Here is the code that I'm currently trying:

private function doDragDrop(event:DragEvent):void 
            {        
                var dropTarget:DataGrid = DataGrid
(event.currentTarget); 
                var dataInfo:ArrayCollection = 
dropTarget.dataProvider as ArrayCollection;
                var items:Array = event.dragSource.dataForFormat
("items") as Array;
                
                var drop:Boolean = true;
                                     
                if(dropInitiator != dropTarget.id){
                        
                        for(var i:int = 0; i < dataInfo.length; i++){
                       if(dataInfo[i].doc_dis_name == items
[0].doc_dis_name) drop = false;
                    }
                    
                    if(String(drop) == 'true'){
                        DragManager.showFeedback(DragManager.COPY);
                        DragManager.acceptDragDrop(dropTarget);

                                                       
                  //set array.source to clear array from last 
dragdrop
                
                   myACCopy.source = new Array();
                   
                   //make copy of arrayCollection for reloading
                   for each (var obj:Object in favorites){
                     myACCopy.addItem(obj);
                   }
                   
                  //now delete favorites currently in database  
                  values.deleteAllFavorites(dsn,userKey);
                  reload();
                 } else{
                        event.preventDefault();
                 }
               }                 
            }
            
             public function reload():void{
                 //Load values from created Array into DB
                 for(var x:int = 0;x<myACCopy.length;x++){
                   var tempDoc_key:int = myACCopy[x]['doc_key'];
                   values.saveFavorite(dsn,userKey,tempDoc_key);
                 }
                 values.getFavorites(dsn,userKey);
            }

Reply via email to