0 Replies Latest reply on Jun 14, 2007 1:53 PM by dkerr

    Drag Drop List to List

      I have a source list and a destination list. I want to submit the contents of the destination list via my sendformdata function along with the other formitems.

      Here are my source/dest lists.

      <mx:VBox dropShadowEnabled="true">
      <mx:Label text="Available Loops"/>
      <mx:List id="srclist" width="300" height="150" allowMultipleSelection="true"
      dragEnabled="true" dropEnabled="true"
      dragMoveEnabled="true" labelField="category" dataTipFunction="myLabelFunc" showDataTips="true"
      alternatingItemColors="[#ece8ff, #ffffff]">
      <mx:Label text="Patched Loops"/>
      <mx:List alternatingItemColors="[#ece8ff, #ffffff]" id="destlist" width="200" height="150" allowMultipleSelection="true"
      dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" labelField="category"/>

      user drags one or more items from the source to dest list. This works great.

      Now I need to pass the dropped/selected data in destlist to myobj, along with the other form items. How?

      private function sendFormdata():void {
      var myobj:Object = new Object();
      myobj.name = myname.text;
      myobj.email = myemail.text;
      myobj.entry = myentry.text;
      myobj.entrycomment = myentrycomment.htmlText;
      myobj.selectedcats= destlist.????

      Second part of my question is that I want the value of myobj.selectedloops to be a comma separated list of categoryid numbers (e.g. 1,3,5). My query, that populates the source list via the remoteobject contains categoryid,category, and description columns. I currently display the category in the labelField of the list, but I need to submit the categoryid to the DB.

      data comes from...

      id="cfdata" showBusyCursor="true"
      <mx:method name="getCats" result="getCats_result(event)" />

      getCats ColdFusion function...
      <cffunction name="getCats" access="remote" returntype="query">
      <cfset var CatData = "">

      <cfquery name="CatData" datasource="#DSN#">
      select categoryid,category,description
      from Categories
      order by category

      <cfreturn CatData />

      and then this function populates the srclist with the data....

      public function getCats_result(event:ResultEvent):void
      srclist.dataProvider = event.result as ArrayCollection;
      destlist.dataProvider =[];

      How do I pass the resulting destlist categoryids to myobj.selectedcats ?

      I don't know how the ArrayCollection organizes the query and how to reference the categoryid in the srclist and destlists.

      I'd appreciate any help.