We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

OnPropertyChanged and live data update delay in SfDataGrid

Hello,

I have problem with live data update in SfDataGrid. In attachment is example with three tables. If is changed one cell of column "A" in "Table 2", and click away from cell, then click to other cell is delayed. This problem is caused with OnPropertChanged evenet with changing multiple columns at once. Imagine, in real i have twenty tables, hundreds of columns, and data with tables / columns are joined, or recalculated. Then if i change one cell, i need to recalculate multiple columns in others tables (in others tabs).

In this case with SfDataGrid is problem this option LiveDataUpdateMode="AllowDataShaping". If is this option removed from SfDataGrid, then reclick delay is very short. I suppose this problem is with recalculating summaries. If is summaries removed from SfDataGrid (or option LiveDataUpdateMode), then live data changing in table works normally.

Thank you for help
Martin

Attachment: TestWPF_new_e267c17e.zip

1 Reply

SR Sivakumar R Syncfusion Team January 24, 2017 08:25 PM UTC

Hi Martin, 
 
We have analyzed the provided sample and performance of summary calculating can be optimized using INotifyPropertyChanging and INotifyPropertyChanged. Below documentation explains the same. 
 
In your sample, you have implemented the interfaced but not in the right way where SfDataGrid can listen to notification and performance summary calculation optimistically.  
For example, Before changing the property you have to call PropertyChanging event, So SfDataGrid will know the property going to be changed and store its previous value internally. After changing the value, you have to trigger PropertyChanged event, So now SfDataGrid recalculates the summary based on old value and new value optimistically without reading entire column of values. 
public double? A 
{ 
    get { return A_; } 
    set 
    { 
        //Raising property changing before it gets changed to backup the old value 
        this.MultiPropertyChanging("A"); 
        A_ = value; 
        this.MultiPropertyChanged("A"); 
 
        this.UpdateProperty("D", "E", "F", "G", "H", "I", "J", "K"); 
        //this.MultiPropertyChanging("D", "E", "F", "G", "H", "I", "J", "K"); 
        //this.MultiPropertyChanged("D", "E", "F", "G", "H", "I", "J", "K"); 
        if (Table1 != null) 
        { 
            Table1.OnPropertyChanged("A"); 
            Table1.OnPropertyChanging("A"); 
        } 
    } 
} 
 
In the same way, Other properties D, E, F, G, H, I, J, K changed to optimistically calculate the summary. 
internal void UpdateProperty(params string[] Prop) 
{ 
    foreach (var propertyName in Prop) 
    { 
        if(propertyName == "D") 
            D = A + B; 
        if (propertyName == "E") 
            E = A + C; 
        if (propertyName == "F") 
            F = D + E; 
        if (propertyName == "G") 
            G = F + C; 
        if (propertyName == "H") 
            H = F + G; 
        if (propertyName == "I") 
            I = G + H; 
        if (propertyName == "J") 
            J = E + I; 
        if (propertyName == "K") 
            K = I + J; 
    } 
} 
 
private double? D_; 
public double? D 
{ 
    get { return D_; } 
    set 
    { 
        OnPropertyChanging("D"); 
        D_ = value; 
        OnPropertyChanged("D"); 
    } 
    //get { return A + B; } 
} 
 
Please find the modified sample below, 
 
Thanks, 
Sivakumar 


Loader.
Up arrow icon