5 Replies Latest reply on Jul 11, 2008 10:32 AM by wkolcz

    Drag from Grid to Panel - Help

    wkolcz Level 1
      I am attempting to make an app when the user can drap from the DataGrid to a Panel and update the panel with the information. Its in a shell right now (still trying to connect to my CFCs...) but I cannot figure out how to get the value from the DataGrid to update the value of the labels in the Panel. Any ideas? Here is my code and thanks in advance. BTW, this is a component of the main app.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%">

      <mx:Script>
      <![CDATA[
      import mx.events.DragEvent;
      import mx.managers.DragManager;
      import mx.managers.PopUpManager;

      private function addProject(e:Event):void {
      PopUpManager.createPopUp(this, apps.addProject, true);
      }

      private function updatePanel(e:DragEvent):void {

      var projectTitle:String = event.dragSource.c1;
      var client:String = event.dragSource.c2;
      var dueDate:String = event.dragSource.c5;
      var reqDate:String = event.dragSource.c4;
      var projectLead:String = event.dragSource.c3;

      projectTitle.text = projectTitle;
      client.text = client;
      dueDate.text = dueDate;
      reqDate.text = reqDate;
      projectLead.text = projectLead;
      }

      ]]>
      </mx:Script>

      <mx:ArrayCollection id="projectData">
      <mx:source>
      <mx:Array>
      <mx:Object c1="Allergy Web Site" c2="Allergy Division, Dept. of IntMed" c3="Paul Linkowski" c4="7/13/2008" c5="7/24/2008"/>
      <mx:Object c1="Brain Tumor Landing Page" c2="BT Programs/Mktg" c3="Jennifer Matthews" c4="7/13/2008" c5="7/24/2008"/>
      <mx:Object c1="Brehm Redesign" c2="Allison Krieger" c3="Wally Kolcz" c4="7/13/2008" c5="7/24/2008"/>
      <mx:Object c1="Bulletin Re-do" c2="Allison Krieger" c3="Wally Kolcz" c4="7/13/2008" c5="7/24/2008"/>
      <mx:Object c1="Center for Arrhythmia Research" c2="Allison Krieger" c3="Wally Kolcz" c4="7/13/2008" c5="7/24/2008"/>
      <mx:Object c1="Compliance/COI/HIPAA" c2="Allison Krieger" c3="Wally Kolcz" c4="7/13/2008" c5="7/24/2008"/>
      <mx:Object c1="Contracting and Payor Relations" c2="Allison Krieger" c3="Wally Kolcz" c4="7/13/2008" c5="7/24/2008"/>
      <mx:Object c1="Events Calendar Module for Web clients" c2="Allison Krieger" c3="Geoff O'Connor" c4="7/13/2008" c5="7/24/2008"/>
      <mx:Object c1="Global REACH - Phase 1" c2="Allison Krieger" c3="Geoff O'Connor" c4="7/13/2008" c5="7/24/2008"/>
      </mx:Array>
      </mx:source>
      </mx:ArrayCollection>

      <mx:Panel width="60%" height="100%" title="Current Live Projects" dragStart="true">
      <mx:DataGrid width="100%" height="100%" dragEnabled="true" dataProvider="{projectData}">
      <mx:columns>
      <mx:DataGridColumn headerText="Project Name" dataField="c1"/>
      <mx:DataGridColumn headerText="Client" dataField="c2"/>
      <mx:DataGridColumn headerText="Project Lead" dataField="c3"/>
      <mx:DataGridColumn headerText="Date Added" dataField="c4"/>
      <mx:DataGridColumn headerText="Due Date" dataField="c5"/>
      </mx:columns>
      </mx:DataGrid>
      <mx:ControlBar width="100%">
      <mx:Button label="Create Project" click="addProject(event)" />
      <mx:Button label="Delete Selected Project"/>
      <mx:Spacer width="25" />
      <mx:Button label="Export Project List as Excel Document" />
      </mx:ControlBar>
      </mx:Panel>
      <mx:Panel title="Project Details" width="40%" height="100%" dragDrop="updatePanel(DragEvent)">
      <mx:Spacer height="20"/>
      <mx:HBox>
      <mx:Label text="Project Title:" fontWeight="bold" textAlign="right" width="110"/><mx:Label id="projectTitle"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Status:" fontWeight="bold" textAlign="right" width="110"/><mx:Label id="status"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Client:" fontWeight="bold" textAlign="right" width="110"/><mx:Label id="client"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Requested Date:" fontWeight="bold" width="110" textAlign="right"/><mx:Label id="reqDate"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Due Date:" fontWeight="bold" textAlign="right" width="110"/><mx:Label id="dueDate"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Project Lead:" fontWeight="bold" textAlign="right" width="110"/><mx:Label id="projectLead"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Project Team:" fontWeight="bold" textAlign="right" width="110"/><mx:Label id="projectTeam"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Priority:" fontWeight="bold" textAlign="right" width="110"/><mx:Label id="priority"/>
      </mx:HBox>
      <mx:Label text=" Project Description:" fontWeight="bold"/>
      <mx:HBox>
      <mx:Spacer width="10"/><mx:Label id="description" width="416"/>
      </mx:HBox>
      <mx:Spacer height="25"/>
      <mx:HBox>
      <mx:Label text="Dev URL:" fontWeight="bold" textAlign="right" width="75"/><mx:Label id="devURL"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Test URL:" fontWeight="bold" textAlign="right" width="75"/><mx:Label id="testURL"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Live URL:" fontWeight="bold" textAlign="right" width="75"/><mx:Label id="liveURL"/>
      </mx:HBox>
      <mx:Spacer height="10" />
      <mx:Label text=" Project Notes:" fontWeight="bold"/>
      <mx:HBox>
      <mx:Spacer width="10"/>
      <mx:TextArea width="98%" bottom="20" id="projectNotes">
      </mx:TextArea>
      </mx:HBox>
      <mx:ControlBar width="100%">
      <mx:Button label="Add Project Note" />
      <mx:Button label="Update Project" />
      </mx:ControlBar>
      </mx:Panel>
      </mx:HBox>