10 Replies Latest reply on Apr 14, 2010 2:29 AM by Sebastien V.

    delete record from arraycollection

    GeorgeWS Level 1

      I have a DG that i fill with data from an arraycollection. I am trying to delete an item from the AC. I filter to a name and press delete that runs this:

       

      private

       

       

       

       

       

      function clickHandler(event:Event):void {

      Alert.show(

      "Are you sure?", lastnameLabel.text, 3, this, alertClickHandler);

      }

       

       

      private function alertClickHandler(event:CloseEvent):void {

       

      if (event.detail==Alert.YES)

      {removePerson();

      }

      }

       

       

      public function removePerson():void {

       

      if (selectedItem !== null) {

      parentDocument.contactListAC.setItemAt({passid:passidLabel.text}, selectedItem);

      sendFormdata22();

      clearInputs();

      }

      }

       

       

       

      private function sendFormdata22():void {

       

      var myobj:Object = new Object();

      myobj.passid = passidLabel.text;

      cfdataDelete.deleteData({user:myobj});

      parentDocument.contactListAC.removeItemAt(selectedItem.id);

       

      clearInputs();

      }

       

       

      The correct item gets deleted from my database but the wrong item (always the first item viewed in the DG) gets deleted from the DG.

       

      Any help would be great.