0 Replies Latest reply on Sep 24, 2009 9:04 AM by Handycam

    Delete button for row in grouping collection/advanced data grid?

    Handycam Level 1

      I have a "delete this row" working for a standard datagrid, thanks to Greg LaFrance's Flex Cookbook and Google Cache.

       

       

      <mx:DataGrid id="testGrid" dataProvider="{menuListCollection}" width="100%" height="100%">
      <mx:columns>
           <mx:DataGridColumn dataField="title"/>
           <mx:DataGridColumn headerText="Delete Item">
           <mx:itemRenderer>
           <fx:Component>
           <mx:LinkButton label="Delete" click="outerDocument.deleteItem(event)"/>
           </fx:Component>
           </mx:itemRenderer>
           </mx:DataGridColumn>
      </mx:columns>
      </mx:DataGrid>
      

      and

       

      public function deleteItem(event:MouseEvent):void{      
           menuListCollection.removeItemAt(testGrid.selectedIndex);
           menuListCollection.refresh(); }
      

       

      My problem is, this doesn't work for an Advanced Data Grid with a Grouping collection on it.  The selected index for the child (grouped) items is -1:

       

      http://grab.by/5Qw

       

      Also, I want to delete individual items, not the group.  I would assume deleting the last member of a group effectively removes the group?

       

      How do I do this?