try changing the verticalScrollPosition property.
 
adg.verticalScrollPosition = 5;
 
Dimitrios Gianninas
RIA Developer and Team Lead
Optimal Payments Inc.
 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Parker 
Ault
Sent: Tuesday, August 05, 2008 12:12 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] scroll to non-visible item in hierarchical 
AdvancedDataGrid



Hey all,

I need to programmatically scroll an AdvancedDataGrid component, without 
changing the currently selected row, to an arbitrary item in a HierarchicalData 
provider.  I have another component that displays the samedataset, and I want 
to synchronize the display states of both,including select, mouseOver and 
mouseOut.  The grid needs to scroll as themouse is hovered over a new item in 
the other component.  I've posted an image here 
<http://client.designcommission.com/temp/flex_component.jpg>  to illustrate.

This seems like it should be a fairly straightforward feature to implement, but 
I've already wasted at least 10 hours struggling with it.  The issue, of 
course, is that scrollToIndex won't work since the list item is most likely 
non-visible and doesn't have an item renderer associated with it to pull an 
index from.

This is the event listener for the click event on the second graph, which 
changes & scrolls to the new selection, and expands the newly selected node.  
No problems there:

        private function nodeClickHandler(e:NodeEvent):void
        {
            grid.selectedItem = e.target.nodeSource;
            grid.expandItem(grid.selectedItem, true, true);
            grid.scrollToIndex(grid.selectedIndex);
        }

I also tried holding the current selection in a temporary variable, changing 
the selection, then switching back to the original selection.  Doesn't work.  I 
tried doing the same but delaying the reset for a frame to give the list a 
chance to update, but that caused all kinds of odd behavior with the indices. 

            var temp:Object = grid.selectedItem;
            grid.selectedItem = e.target.nodeSource;
            var itemIndex:uint = grid.selectedIndex;
            grid.invalidateList();
            grid.invalidateDisplayList();
            grid.selectedItem = temp;
            grid.scrollToIndex(itemIndex);

The only other method I could think of was to use a frameloop and iterate 
through the list until the item came into view and returned a renderer, but it 
started returning renderers even when the item was off screen, and attempting 
to scroll to the renderer's index did nothing.  I'm at a complete loss here!  
Can anyone point me in the right direction!?

Parker


 

-- 
WARNING
-------
This electronic message and its attachments may contain confidential, 
proprietary or legally privileged information, which is solely for the use of 
the intended recipient.  No privilege or other rights are waived by any 
unintended transmission or unauthorized retransmission of this message.  If you 
are not the intended recipient of this message, or if you have received it in 
error, you should immediately stop reading this message and delete it and all 
attachments from your system.  The reading, distribution, copying or other use 
of this message or its attachments by unintended recipients is unauthorized and 
may be unlawful.  If you have received this e-mail in error, please notify the 
sender.

AVIS IMPORTANT
--------------
Ce message électronique et ses pièces jointes peuvent contenir des 
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au 
seul usage du destinataire visé.  L'expéditeur original ne renonce à aucun 
privilège ou à aucun autre droit si le présent message a été transmis 
involontairement ou s'il est retransmis sans son autorisation.  Si vous n'êtes 
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, 
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses 
pièces jointes, de votre système.  La lecture, la distribution, la copie ou 
tout autre usage du présent message ou de ses pièces jointes par des personnes 
autres que le destinataire visé ne sont pas autorisés et pourraient être 
illégaux.  Si vous avez reçu ce courrier électronique par erreur, veuillez en 
aviser l'expéditeur.

Reply via email to