Adobe Flex: Delete Row In DataGrid

Here’s the code to delete a row in a DataGrid or AdvancedDataGrid. ActionScript is needed for the delete function.

Assuming this is how your XML data looks like

Using "mydataprovider" as dataprovider for the AdvancedDataGrid, the code would look like this.

Every row has an extra column where the delete link is displayed for you to delete a row. The action takes place in the click property of the LinkButton component where we call the deleteRow() function to do the row deletion.

Related Posts Plugin for WordPress, Blogger...

5 comments

  1. Tnaks for the info here. I have a datagrid with a combobox itemrenderer/editor. When I delete a row similarly to the way your are, the value in the next row’s combobox does not move up as do th eother values on the next row. Instead a blank combobox is displayed. I have tried dataprovider.refresh(), invalidateProperties, executeBindings() – all on the dataprovider for the datagrid to no avail. What is left to try? Thanks for your help.

  2. hey, ive stopped with adobe flex as i only tried it to check what it can do. if anyone gets to this post and knows the answer please do share.

  3. I’m glad I discovered this site, I couldnt obtain any info on this subject matter prior to. Also run a website and if you’re ever interested in doing some visitor writing for me please feel free to let me know, i’m always look for people to check out my website. Please stop by and leave a comment sometime!

  4. I am having problems implementing this in a DataGrid with selectable=”false”. The selectedIndex is -1, and so nothing is removed.

    Is there a way to implement this with a non-selectable Data Grid?

Leave a Reply

Your email address will not be published. Required fields are marked *