So i was testing around a bit more. When I use a timer with 20ms on a 30fps movie it works. You see the selected item bar flicker though and it is not a good solution I reckon. Another thing is that when you hit the delete Button several times really quick it still sometimes happens that it selects the one after. :-(
Greets, Max --- In [email protected], "m.frigge" <[EMAIL PROTECTED]> wrote: > > Mh my Dataprovider is an ArrayCollctionboth, but methods do not work. > I still have the same effect. > > --- In [email protected], "Tracy Spratt" <tspratt@> wrote: > > > > You might also try using callLater to set the index, to give the DG time > > to re-render. > > > > Tracy > > > > -----Original Message----- > > From: [email protected] [mailto:[EMAIL PROTECTED] On > > Behalf Of Muzak > > Sent: Saturday, December 22, 2007 11:13 AM > > To: [email protected] > > Subject: Re: [flexcoders] Select next DataGrid item after one removed > > > > 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" <m.frigge@> > > To: <[email protected]> > > 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 > > >

