Hi Alex, thanks for the help.

I agree that validateNow() is a bad things and breaks the deferred validation.

However everything else in updateCaretForDataProviderChange is  done in 
"immediate" way
And validateNow() is also called at other places in the same method:

- line 5418 : validateNow () when managing REFRESH
- line  5409 & 5442 :  call     ensureCellIsVisible(caretRowIndex, -1) that 
calls in turn validateNow();

So if I change that to 
newCaretRowIndexChanged=true; 
invalidateProperties();

I will have to do it for the whole method, and call the actual 
updateCaretForDataProviderChange in commitProperties.

But then ensureCellIsVisible(caretRowIndex, -1) does not need to call 
validateNow() anymore , or we lose all the benefits of deferring.

But it's a public method.

Two options:

1) duplicate ensureCellsVisible as ensureCellsVisibleDeffered , that does not 
call validateNow()
2) [Preferred] add an optional parameter ensureCellIsVisible(rowIndex:int = -1, 
columnIndex:int = -1, validateNow: Boolean = true):void

In the second option, I change the API, but don't break the existing calls.

What do you think?

Maurice 

-----Message d'origine-----
De : Alex Harui [mailto:aha...@adobe.com] 
Envoyé : vendredi 11 octobre 2013 16:44
À : dev@flex.apache.org
Objet : Re: Need help on https://issues.apache.org/jira/browse/FLEX-33813 
(DataGrid goes blank)

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