title: How to update List dynamically when deleting item from database
body: <p>I have a List that displays the contents of an SQlite database I have created.  However, When I run the function to delete one of the user-selected items from the database, the items is still displayed until I refresh the View (right now by clicking 'home' and the reentering the View).  How can I get the list to automatically update when the user deletes an item?  </p>
  
  <p>Here's my delete function and list code:</p>
  
  <pre><code>protected function getAllcards():void   // retrieve the cards from the DB and display
          {
              var stmt:SQLStatement = new SQLStatement();
              var conn:SQLConnection = new SQLConnection();
              stmt.sqlConnection = conn;
              conn.open(File.applicationStorageDirectory.resolvePath("FlashCards.db"));
              stmt.text = "SELECT cTitle FROM cardItems";
              stmt.execute();
              myCardsList.dataProvider = new ArrayCollection(stmt.getResult().data);
  
          }
  
          protected function myCardsList_creationCompleteHandler(event:FlexEvent):void  //executed when the List completes loading
          {
              getAllcards();
          }
  
  
  
  protected function deleteButton_clickHandler(event:MouseEvent):void  // pushed delete button
          {
              if(myCardsList.selectedItem != null)
              {
              var stmt:SQLStatement = new SQLStatement();
              var conn:SQLConnection = new SQLConnection();
              stmt.sqlConnection = conn;
              conn.open(File.applicationStorageDirectory.resolvePath("FlashCards.db"));
              stmt.text= "DELETE FROM cardItems WHERE cTitle = ?";
              stmt.parameters[0] = myCardsList.selectedItem.cTitle;
              stmt.execute();
              refresher();
              }
  
          }
  </code></pre>
  
  <p>private function refresher():void
              {
                  var stmt:SQLStatement = new SQLStatement();
                  var conn:SQLConnection = new SQLConnection();
                  stmt.sqlConnection = conn;
                  conn.open(File.applicationStorageDirectory.resolvePath("FlashCards.db"));
                  stmt.text = "SELECT * FROM cardItems"; //REFRESH LIST HERE?
                  stmt.execute();
                  myCardsList.dataProvider = new ArrayCollection(stmt.getResult().data);
              }</p>
  
  <p><strong>List:</strong></p>
  
  <pre><code>&lt;s:List id="myCardsList" x="10" y="10" left="0" right="0" top="0" bottom="0" width="1004"
          height="500" 
          creationComplete="myCardsList_creationCompleteHandler(event)" enabled="true"&gt;
      &lt;s:itemRenderer&gt;
          &lt;fx:Component&gt;
              &lt;s:MobileItemRenderer label = "{data.cTitle}"/&gt;  // The Application is a mobile app
          &lt;/fx:Component&gt;
      &lt;/s:itemRenderer&gt;
  &lt;/s:List&gt;
  </code></pre>
  
  <p>Thanks for any help!  =)</p>