2 Replies Latest reply on May 14, 2007 2:56 PM by peterrowe

    Button "DELETE"

    Clarence_69 Level 1
      No errors in this script but the button doesn't work. ..

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" xmlns="*">

      <mx:Model id="employeeModel" source=""/>
      <mx:Panel title="Employee List">

      <mx:DataGrid id="dg" dataProvider="{employeeModel.employee}">
      <mx:DataGridColumn dataField="name" headerText="Name" width="120"/>
      <mx:DataGridColumn dataField="phone" headerText="Phone" width="100"/>
      <mx:DataGridColumn dataField="email" headerText="Email" width="160"/>
      public var dataObject:Object;

      function removeItem() {
      if (dg.selectedIndex!=undefined)

      <mx:Button label="Delete" width="75" enabled="{dg.selectedItem!=null}" click="removeItem()" />




        • 1. Re: Button &quot;DELETE&quot;
          Clarence_69 Level 1
          0 Replayes ...Flex Builder S Support? ahahahahahah
          • 2. Re: Button &quot;DELETE&quot;
            peterrowe Level 1
            The dg grid is bound to the employeeModel data model so it's contents are coming from there.The Delete button deletes an item in dataObject. You declared dataObject as an Object but you never stored anything in it, so it's empty. You are also not showing what's in it anywhere

            You need to removed the item from the source of your data in employeeModel, or you need to store the data in dataObject and then bind the dg to it to see what's in it. Then the deletion of an item will be reflect in the dg