Try using table.verticalScrollPosition = table.maxVerticalScrollPosition next to scrollToIndex
Ravi On Thu, Jul 30, 2009 at 11:45 AM, flex_oink <thydo...@gmail.com> wrote: > > Here is the code I am working on. There are some bar diagrams > associated to each node of AdvancedDatagrid. Now suppose, I clicked on > first node. It expands and shows me the first Diagram. What I want is, > when I click on 3rd or 4th node, the datagrid should get scrolled to > the clicked item. I tried with many things. scrollToIndex() aint > working here. Can any one lend a helping hand. > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> > > <mx:Style source="assets/css/fonts.css" /> > <mx:Style source="assets/css/global.css"/> > > <mx:Script><![CDATA[ > import mx.events.ListEvent; > import mx.events.*; > import data.DataHelper; > import mx.controls.Alert; > > private function scrollToItem(event:ListEvent):void{ > //var _rowIndex:int = event.rowIndex; > //event.scrollToIndex(3); > //Alert.show("_rowIndex : "+_rowIndex); > //table.selectedItem = event.target.nodeSource; > //table.expandItem(table.selectedItem,true,true); > //table.selectedIndex = 0; > table.expandItem(table.selectedItem, true, true); > table.scrollToIndex(table.selectedIndex); > table.validateNow(); > > } > > // private function nodeClickHandler(e:Nod):void > // { > // grid.selectedItem = e.target.nodeSource; > // grid.expandItem(grid.selectedItem, true, true); > // grid.scrollToIndex(grid.selectedIndex); > //} > ]]> > > </mx:Script> > > <mx:HBox> > <mx:Button label="display all" click="{table.expandAll()}"/> > <mx:Button label="close all" click="{table.collapseAll()}"/> > </mx:HBox> > > <mx:AdvancedDataGrid id="table" height="100%" > sortExpertMode="true" itemClick="scrollToItem(event)" > variableRowHeight="true" useRollOver="false" width="100%"> > > <mx:dataProvider> > <mx:HierarchicalData > source="{DataHelper.getDataProvider()}"/ > > > </mx:dataProvider> > > <mx:columns> > <mx:AdvancedDataGridColumn dataField="material" > headerText="CLICK ON AN ARROW TO SEE ACCOMPANYING CHART" width="150"/> > </mx:columns> > > <mx:rendererProviders> > <mx:AdvancedDataGridRendererProvider dataField="detail" > renderer="renderers.ChartRenderer" columnIndex="0"/> > </mx:rendererProviders> > > </mx:AdvancedDataGrid> > > </mx:Application> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---