Hi Maurice,

Thanks for digging into this.  ValidateNow() can fix a lot of things, but
it can also cause inefficiencies if the things it validates were going to
get invalidated shortly after.  I don't know if that is the case or not
here.

If it were me (and it isn't) I would change the collectionChangeHandler to
set a flag and call updateCaretForDataProviderChange in updateDisplayList.
 InvalidateDisplayList is called in the collectionChangeHandler, and in
theory, stuff like contentHeight should be resolved by the time you get to
updateDisplayList.

Last night I checked in a fix for another similar DG issue in a similar
way by deferring work to measure().

-Alex

On 10/11/13 6:55 AM, "Maurice Amsellem" <maurice.amsel...@systar.com>
wrote:

>Hi, I would like your help on a fix for
>
>https://issues.apache.org/jira/browse/FLEX-33813 (DataGrid goes blank
>when scrolled and content is reset)
>
>I managed to spot where the issue is:
>
>Grid.as 
>line 850:
>const gridViewLayout:GridViewLayout = centerGridView.gridViewLayout;
> const gridMaxVSP:Number = contentHeight - height;
>const centerContentHeight:Number =
>Math.ceil(gridViewLayout.gridDimensionsView.getContentHeight());
> const centerMaxVSP:Number = centerContentHeight - centerGridView.height;
>const vsp:Number = (centerMaxVSP / gridMaxVSP) * value;
> centerGridView.verticalScrollPosition = vsp;
>
>=> contentHeight  is NaN so all computations fails and
>verticalScrollPosiiton is set to NaN, which clears all the renderers
>(goes blank)
>
>My assumption is that the Grid is not ready yet, so it's missing a
>validateNow() somewhere().
>
>Call chain: 
>Grid.dataProvider_collectionChangeHandler(event:CollectionEvent)
>=> Grid.updateCaretForDataProviderChange(event:CollectionEvent):void
>
>In Grid.updateCaretForDataProviderChange(): [line 5356],
>when managing RESET event in line 5448,
>if the caret is not found (which is the case, since all data is new),  we
>call directly 
>verticalScrollPosition = 0;
>
>=> I added validateNow() before the call, and it's fixed.
>
>Do you validate ? 
>
>Maurice 
>
>
>Maurice Amsellem
>SYSTAR R&D - BusinessBridgeFX
>

Reply via email to