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

    Drag Drop List to List

    dkerr
      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:List>
      </mx:VBox>
      <mx:VBox>
      <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"/>
      </mx:VBox>

      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?

      <mx:Script>
      <![CDATA[
      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.????
      cfdataInsert.addData({user:myobj})
      }
      ]]>
      </mx:Script>

      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...

      <mx:RemoteObject
      id="cfdata" showBusyCursor="true"
      destination="ColdFusion"
      source="da8.Constellation.entries">
      <mx:method name="getCats" result="getCats_result(event)" />
      </mx:RemoteObject>

      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
      </cfquery>

      <cfreturn CatData />
      </cffunction>

      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.

      Thanks,
      Don