sfDataGrid not showing up changes

Hello every, 

I have sfDataGrid bound to ObservableCollection from my repo. But the Grid does not refresh its UI when the data source changes. I don't know what I am doing wrong.

Below is my code:

sfDataGrid1.DataSource = GetCustomerListViews;

public ObservableCollection<CustomerListView> GetCustomerListViews =>  _unitOfWork.CustSups.GetCustomerListViews();


6 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team June 8, 2020 03:19 PM UTC

Hi Paul,

Thank you for contacting Syncfusion support.

Based on the provided information, your using Observable collection binded to Datasource When an item is added/removed in ObservableCollection, SfDataGrid automatically refresh the UI as ObservableCollection implements INotifyCollectionChanged. Please refer the below user documentation for more details,

UG Link: https://help.syncfusion.com/windowsforms/datagrid/databinding

SfDataGrid listens and responds to the manipulation operations such as add, delete and data update (property change) at runtime. DataGrid refresh the sorting, filtering, grouping and summaries based on SfDataGrid.LiveDataUpdateMode property. Please refer the below code snippet,

 
this.SfDataGrid1.LiveDataUpdateMode = LiveDataUpdateMode.AllowDataShaping 

UG Link: https://help.syncfusion.com/windowsforms/datagrid/datamanipulation

Sample Link: https://www.syncfusion.com/downloads/support/forum/154964/ze/Sample1194740171

We hope this helps. Please let us know, if you require further assistance on this.

Regards,
Vijayarasan S




Marked as answer

PA Paul June 9, 2020 01:36 PM UTC

Hello Vijayarasan,

Thanks for reply.  I will implement your suggestion and get back to you asap.


VS Vijayarasan Sivanandham Syncfusion Team June 10, 2020 06:07 AM UTC

Hi Paul,

Thanks for the update.
 
 
We will wait to hear from you. 
 
Regards, 
Vijayarasan S 




PA Paul June 29, 2020 10:10 AM UTC

Hello Vijayarasan,

It did not work for me. I don't know what I am doing wrong. I have tried with different collection types and even bound it BindingSource but to no avail

My collection is coming from repository. Is there a way to manually force refresh of sfSDataGrid?


MA Martin June 29, 2020 02:42 PM UTC

Hi Paul,

I had the same issue. The only way round it I foubd was to use sfdatagrid.selectedindex = 0 after originally populating the data. It appears without selecting an index it does not receive updates.

Thanks, Martin


VS Vijayarasan Sivanandham Syncfusion Team June 30, 2020 04:56 PM UTC

Hi Paul / Martin,

Thanks for the update.

In SfDataGrid Collection must be an ObservableCollection or DataTable and also underline property derived from
INotifyCollectionChanged. SfDataGrid automatically refresh the UI as ObservableCollection implements INotifyCollectionChanged.

SfDataGrid listens and responds to the manipulation operations such as add, delete and data update (property change) at runtime. DataGrid refresh the sorting, filtering, grouping and summaries based on SfDataGrid.LiveDataUpdateMode property.

There is no related between SfDataGrid.SelectedIndex settings and SfDataGrid DataSource Updation.

if you still facing the same issue? When above mentioned settings are used in your sample, can you please share us below things?
       
        1. Brief replication procedure/video illustration of the reported issue

        2.
Code snippet related to SfDataGrid settings
        3. Syncfusion product version

Regards,
Vijayarasan S
 


Loader.
Up arrow icon