3 Replies Latest reply on Jun 23, 2008 9:26 AM by flatpickinJohn

    Deleting row from datagrid

    flatpickinJohn
      How do you delete a row from a basic datagrid with an xml object as a dataprovider?
        • 1. Re: Deleting row from datagrid
          flatpickinJohn Level 1
          trying to do this :

          SearchXML.PA.Contracts.removeItemAt(datagridContracts.selectedIndex);

          And I get this error:

          TypeError: Error #1006: value is not a function.
          • 2. Re: Deleting row from datagrid
            Karl_Sigiscar_1971 Level 3

            The removeItemAt() method is part of the ICollectionView interface. You can use it with an ArrayCollection, but not with XML.

            You need to remove the corresponding XML node using the e4x syntax delete.
            • 3. Re: Deleting row from datagrid
              flatpickinJohn Level 1
              Thanks. I tried this:

              private function handleRemoveRow():void
              {
              //SearchXML.PA.Contracts.CONTR[datagridContracts.selectedIndex].@Status="Deleted";
              trace("selected index: ", datagridContracts.selectedIndex);
              trace("SearchXML.PA.Contracts-before delete: ", SearchXML.PA.Contracts.toXMLString());

              //delete SearchXML.PA.Contracts(datagridContracts.selectedIndex);
              delete SearchXML.PA.Contracts(1);


              trace("SearchXML.PA.Contracts-after delete: ", SearchXML.PA.Contracts.toXMLString());

              }

              and got the same error:

              TypeError: Error #1006: value is not a function.
              at CommercePartyDataEntry/handleRemoveRow()[C:\Users\John\Documents\Flex Builder 3\CP_Edit_v2\src\CommercePartyDataEntry.mxml:516]
              at CommercePartyDataEntry/___CommercePartyDataEntry_Button11_click()[C:\Users\John\Documents \Flex Builder 3\CP_Edit_v2\src\CommercePartyDataEntry.mxml:810]

              Any thoughts on this?