Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1085
DataSourceBase.RefreshGrid() after ExpandToLevelAsync hangs application
posted

Hello there

I'm trying to expand all Rows programmatically which _usually_ works with the following code:

var filterViewModels = PivotGrid.DataSource.Rows.Where(fvm => fvm is IFilterViewModel).ToList();

for (int i = 0; i < filterViewModels.Count; i++)
{
var filterViewModel = filterViewModels[i] as IFilterViewModel;
if (i == filterViewModels.Count - 1)
{
((DataSourceBase)PivotGrid.DataSource).ExpandToLevelAsync(filterViewModel, filterViewModel.Hierarchy.Levels.Count - 1).ContinueWith(
(t) => PivotGrid.DataSource.RefreshGrid(), TaskContinuationOptions.ExecuteSynchronously);
}
else
{
((DataSourceBase)PivotGrid.DataSource).ExpandToLevelAsync(filterViewModel, filterViewModel.Hierarchy.Levels.Count - 1);
}
}

##################

I used the word usually because in certain environments my application hangs on "PivotGrid.DataSource.RefreshGrid()" (hangs means doesn't respond to anything while having 0% CPU usage)

This occurs on 2 PCs with the same configuration: 

HP Compaq Elite 8300 SFF

Intel Core i5-3570
Win 7 32 bit

This Error occurs only when i try to expand all rows programmatically (using the "+"-indicators of the UI works as expected),

expanding single Nodes by Code (eg. when restoring a previous saved state of the grid) works flawlessly.

Does anyone have an Idea how to fix/avoid this? I really need this functionality...

BR

Parents
  • 8831
    posted

    Hello,

    How many hierarchies you operate with when this happen? Could you try to refresh grid once you have all nodes expanded. I mean if you collect the task objects which ExpandToLevelAsync return and then refresh the grid:

    Task.Factory.ContinueWhenAll(tasks.ToArray(), t => PivotGrid.DataSource.RefreshGrid(), TaskContinuationOptions.ExecuteSynchronously);

    Regards,
    Plamen.
     

Reply Children