Hi, >From what I understand of ur code posted before, u want to physically move the data one index above or below in the dataprovider array and display it on the datagrid. If this is correct then ur code looks fine, but there is one problem.
U have handled the boundary condition for Move Up functionality namely selectedIndex = -1 or selectedIndex = 0 but the same is not the boundary condition for Move Down. Here u have to check for selectedIndex = -1 (Unseleted row) & selectedIndex = dg.dataprovider.length (Last row selected). (If I select the first row in the datagrid which is equivalent to selectedIndex = 0 then I should be able to move it down.) Also in case of the logic used for Move Down, u should drop the node first & then add the node at the next position to get the desired effect. My understanding of addItemAt is that every element equal to or greater then the index to be added at gets shifted one ahead. (If this is not the case then ur code is fine. Please let me know that I had it understood wrong) Hope this helps. On Apr 25, 11:34 am, Malek S <male...@gmail.com> wrote: > any updates > > On Thu, Apr 21, 2011 at 12:15 PM, Malek S <male...@gmail.com> wrote: > > thanks for your reply > > but my problem is different. > > > On Thu, Apr 21, 2011 at 11:24 AM, MIDHUN TM <midhunik...@gmail.com> wrote: > > >> hii > >> You need to use the "verticalScrollPosition" property of the > >> datagrid to move the scroll down and up. You can set and get the > >> property using 'verticalScrollPosition' of the datagrid. Happy Coding > > >> Regards > >> Midhun > > >> On Thu, Apr 21, 2011 at 9:40 AM, Malek S <male...@gmail.com> wrote: > >> > HI, > >> > I am facing a problem . My scenario is i have datagrid and two > >> buttons(up > >> > and down). > >> > Now my requriement is i want to move datagrid up and down on click of > >> > respective button. > > >> > on click of button i have written a funtion MoveRowUp('up') > > >> > and the function has to scroll the datagrid. > >> > Can some body help in doing it. > > >> > private function MoveRowUp(direction:string):void { > > >> > //create new grid and assign id of your grid > >> > var grid:Datagrid = dg; > >> > var sIndex:Number = dg.selectedIndex. > > >> > // how toget the row and subsequenty scroll the datagrid. > > >> > } > > >> > -- > >> > You received this message because you are subscribed to the Google > >> Groups > >> > "Flex India Community" group. > >> > To post to this group, send email to flex_india@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > flex_india+unsubscr...@googlegroups.com. > >> > For more options, visit this group at > >> >http://groups.google.com/group/flex_india?hl=en. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Flex India Community" group. > >> To post to this group, send email to flex_india@googlegroups.com. > >> To unsubscribe from this group, send email to > >> flex_india+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >>http://groups.google.com/group/flex_india?hl=en. -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.