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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Some problems obtaining a correct refresh on a detail grid when data are changed

Thread ID:

Created:

Updated:

Platform:

Replies:

130982 Jun 14,2017 04:00 PM UTC Jun 16,2017 04:06 AM UTC WPF 3
loading
Tags: SfDataGrid
Silvio
Asked On June 14, 2017 04:00 PM UTC

Hi,

please consider the zip file I have here attached where you can find a modified project and a video that I have made to explain my question.
I have changed one of your examples regarding master-detail grid.
I have added a button that simply adds some extra detail records to the details data.
How can I obtain a correct refresh of the detail data on the record's details as soon as I click on my new button?
Thank you for your help.

Silvio



Attachment: MasterDetailsViewDemo_30b95a11.zip

Srinivasan Vasu [Syncfusion]
Replied On June 15, 2017 07:01 AM UTC

Hi Silvio, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your query and you have used List collection to bind with ItemsSource of SfDataGrid. When you adding the records in runtime, it will not be reflected in view. Because. List collection doesn’t support INotifyPropertyChanged. You can use ObservableCollection insteadof List, which will update the collection automatically when items are added or removed in runtime.  Whether the child records count is zero, you have to invoke the UpdateDataRow method when a new records added in runtime. 
 
Please refer the below code example. 
 
using Syncfusion.UI.Xaml.Grid.Helpers; 
using Syncfusion.UI.Xaml.Grid; 
 
  private void buttonAddDetail_Click(object sender, RoutedEventArgs e) 
        { 
            var context = this.DataContext as ViewModel; 
            var rec1 = context.OrdersDetails[4]; 
            var rec2 = context.OrdersDetails[3]; 
            rec2.OrderDetails.Add(new OrderDetails(1111, 7, 7, 7, 7, "7", DateTime.Now)); 
            if (rec1.OrderDetails.Count == 0) 
            {      
               // Whether the child records count is zero, you should invoke the UpdateDataRow method when a new record added in runtime.         
                 
                rec1.OrderDetails.Add(new OrderDetails(2222, 8, 8, 8, 8, "8", DateTime.Now)); 
                this.dataGrid.UpdateDataRow(this.dataGrid.ResolveToRowIndex(rec1)); 
            } 
        } 
 
 
We have modified the sample as per your requirement and you can download the same from the below location. 
 
 
Please refer the below Kb Link: 
 
 
Regards, 
Srinivasan 


Silvio
Replied On June 15, 2017 07:57 AM UTC

Dear  Srinivasan Vasu 

thank you very very much!
Your help has been very usefull to me.
Have a nice day.

Silvio

Srinivasan Vasu [Syncfusion]
Replied On June 16, 2017 04:06 AM UTC

Hi Silvio, 
  
Thanks for your update.  
  
Please let us know if you need further assistance. 
  
Regards,
Srinivasan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;