Thanks Paul

 

Sorry, I did try to search for the answer myself but wasn't really sure what
to look for. This is still my first flex project and I gotta say I am not
enjoying it.

 

Anyway the following that you suggested works fine, albeit there is a bit of
a flash

 

markSheetXMLData = _dataManager.returnMarkSheetData().group;

                                                

tile2.verticalScrollBar.scrollPosition = 0;

 

Thanks

 

Paul

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Andrews
Sent: 04 March 2008 15:03
To: flexcoders@yahoogroups.com
Subject: [SPAM] Re: [flexcoders] How to reset a scrollbar - would really
appreciate some assistance please

 

Check out the help docs!

 

I'm not sure if you mean scroll the datagrid, or scrollbars on the hbox.

 

DataGrid:

 


scrollToIndex

()

method

 

public function scrollToIndex(index:
<http://127.0.0.1:61597/help/nftopic/com.adobe.flexbuilder.help/langref/int.
html> int):
<http://127.0.0.1:61597/help/nftopic/com.adobe.flexbuilder.help/langref/Bool
ean.html> Boolean 

Ensures that the data provider item at the given index is visible. If the
item is visible, the verticalScrollPosition property is left unchanged even
if the item is not the first visible item. If the item is not currently
visible, the verticalScrollPosition property is changed make the item the
first visible item, unless there aren't enough rows to do so because the
verticalScrollPosition value is limited by the maxVerticalScrollPosition
property. 

HBox:

Ifyou mean the scroll bar on a HBox then use the scrollPosition property of
the HBox scrollbar. The HBox has a scrollbar property: verticalScrollBar.

So, for your hbox it would be tile2.verticalScrollBar.scrollPosition = 0;

Paul

----- Original Message ----- 

From: Paul Steven <mailto:[EMAIL PROTECTED]>  

To: flexcoders@yahoogroups.com 

Sent: Tuesday, March 04, 2008 2:32 PM

Subject: [flexcoders] How to reset a scrollbar - would really appreciate
some assistance please

 

I want to reset a scroll bar to the top when returning to a dynamically
populated datagrid in my app. Basically the datagrid displays info about
different students so clicking on a students name in a list takes you to
this datagrid. Problem is if I am looking at the data of one student and
scroll down this info, then leave this section and return as a different
student, the scroll bar is where I left it with the previous student

 

Here is the code of the relevant section. As no scroll bar is explicitly
coded, I do not know how to ensure it resets.

 

<mx:VBox width="720" id="tile2" height="190">

                                                

            <mx:Repeater id="markSheetRepeater"
dataProvider="{this.markSheetXMLData}" >


                                                                        

                        <local:MarkSheetItem
xmlItem="{markSheetRepeater.currentItem}" id="markSheetItem">

 


                                    </local:MarkSheetItem>


                                                                        

            </mx:Repeater>         

                                                            

</mx:VBox>               

 

Btw this is Flexbuilder 2

 

Thanks in advance

 

Paul

 

Reply via email to