Disable the dataprovider from dispatching events before manipulating it and enable it again afterwards. Assuming you're using an ArrayCollection as dataProvider, the following works:
var index:int = dg.selectedIndex; ac.disableAutoUpdate(); ac.removeItemAt(index); dg.selectedIndex = index; ac.enableAutoUpdate(); regards, Muzak ----- Original Message ----- From: "m.frigge" <[EMAIL PROTECTED]> To: <flexcoders@yahoogroups.com> Sent: Saturday, December 22, 2007 4:40 PM Subject: [flexcoders] Select next DataGrid item after one removed Hey there, I hava a DataGrid and when I click a Delete Button, the selected item gets removed (obviously). But then I want the next item to be selected, so that you can keep on pressing Delete and remove one item after the other.. as it is in Yahoo mail. So I tried something like this: oldIndex = grid.selectedIndex; removeItem(grid.selectedIndex) // functioin that removes item from arrayCollection grid.selectedIndex = oldIndex; => but then it always selects one after the one I want to be selected. So I tried something like this: oldIndex = grid.selectedIndex; removeItem(grid.selectedIndex) // functioin that removes item from arrayCollection grid.selectedIndex = oldIndex -1; => but then it always selects one before the one I want to be selected. Strange.. isnt it? Any ideas why this is happening.. Cheers, Max -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/