For down btn else if(event.target.name == "btnDown") { if(j < dgSlideInfo.dataProvider.length-1) { j = j + 1; arr = new Array(xmlCol.getItemAt(j)); } }
On Wed, Apr 27, 2011 at 4:55 PM, harinath m <harinath...@gmail.com> wrote: > Hi, > The below code may be help for you i used xmllist collection as my data > provider for data grid > > private function fnUpDownData(event:MouseEvent):void > { > if(dataGrid.selectedItem != null) > { > var j:int = dataGrid.selectedIndex; > var intGetID:int; > var arr:Array; > var intUpDownDataID:int; > intGetID = > cuePointXMLList.getItemIndex(dataGrid.dataProvider[dataGrid.selectedIndex]); > intUpDownDataID = > cuePointXMLList.getItemIndex(dataGrid.dataProvider[dataGrid.selectedIndex]); > if(event.target.name == "btnUp") > { > if(dataGrid.selectedIndex > 0) > { > j = j - 1; > arr = new Array(cuePointXMLList.getItemAt(j)); > } > } > else if(event.target.name == "btnDown") > { > if(j < dataGrid.dataProvider.length-1) > { > j = j + 1; > arr = new Array(cuePointXMLList.getItemAt(j)); > } > } > cuePointXMLList.setItemAt( > new XML('<CuePoint>' +'<Time> '+dataGrid.dataProvider[intGetID].Time+' > </Time> ' + > '<Type> '+dataGrid.dataProvider[intGetID].Type+' </Type> ' + > '<Name> '+dataGrid.dataProvider[intGetID].Name+' </Name> > '+'</CuePoint>'),j); > if(arr != null) > { > cuePointXMLList.setItemAt(new XML('<CuePoint>' +'<Time> '+arr[0].Time+' > </Time> ' + > '<Type> '+arr[0].Type+' </Type> ' + > '<Name> '+arr[0].Name+' </Name> '+'</CuePoint>'),intUpDownDataID); > } > dataGrid.dataProvider = cuePointXMLList; > /* for(var i:int=0;i<dataGrid.dataProvider.length;i++) > { > cuePointXMLList[i].slideid = i+1; > } */ > dataGrid.selectedIndex = j; > } > else > { > Alert.show('Select the Data Grid.'); > } > } > Regards, > Harinath Mekala > > On Wed, Apr 27, 2011 at 2:41 PM, Kronos <utkars...@gmail.com> wrote: > >> Sorry its dg.dataprovider.length -1 for the last row selected. >> >> On Apr 27, 2:09 pm, Kronos <utkars...@gmail.com> wrote: >> > 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. >> >> > -- 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.