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

DataGrid throws exception if underlying datasource is empty, loses grouping on refresh

a) DataGrid that is grouped by say column A, is throwing exception if ObservableCollection is empty. (To reproduce this in samplebrowser: SalesInfoViewModel,YearlySalesDetails return this as empty collection)

b) DataGrid that is Grouped by column A is loosing grouping when underlying datasource gets a new instance. My datasource is instantiated new each time on refresh and this is causing grouping to loose. Please advise 

5 Replies

PS Prakash Selvaraj Syncfusion Team April 5, 2013 10:54 AM UTC

Hi Bhavani,

 

Thank you for choosing Syncfusion Products.

 

Query a:

 

This issue is fixed in our latest service pack release. Please upgrade to that. Else you can overcome this issue by setting SourceType to the DataGrid as shown in the following code snippet.

 

Code Snippet [C#]:

 


this.datagrid.SourceType = typeof(OrderInfo);

 

Query b:

 

This is the default behaviour of the DataGrid. If you set the ItemsSouce to DataGrid, then the DataGrid will clear the SortColumnDescriptions and GroupColumnDescriptions collection. To overcome this, we would suggest you to take a clone for GroupColumnDescriptions collection before assigning the ItemsSource to DataGrid. Then you can add the items to the GroupColumnDescriptions collection in the DataGrid.

 

Please let us know if you need further assistance.

 

Regards,

Prakash S.

 



BS bhavani sangannagari April 5, 2013 04:04 PM UTC

Query a:

 

Code Snippet [C#]:

 


this.datagrid.SourceType = typeof(OrderInfo); 


After above statement, does not throw exception but when underlying observable collection is repopulated with objects [say by datagrid populating objects based selected item of different control], datagrid still shows up empty. 


Query b:


I get nested group headers [one inside another] after doing below.   I added if groupcolumndescription is missing to GroupColumnDescriptions but its showing up multiple group headers.


This is the default behaviour of the DataGrid. If you set the ItemsSouce to DataGrid, then the DataGrid will clear the SortColumnDescriptions and GroupColumnDescriptions collection. To overcome this, we would suggest you to take a clone for GroupColumnDescriptions collection before assigning the ItemsSource to DataGrid. Then you can add the items to the GroupColumnDescriptions collection in the DataGrid.



PS Prakash Selvaraj Syncfusion Team April 8, 2013 11:56 AM UTC

Hi Bhavani,

 

Query A:

We unable to reproduce the reported issue. We have created a simple sample based on your requirements and also attached a video by which we have done the testing. Please refer the below sample and the video.

 

Query B:

Please follow the incident id 106676 for further technical support on the reported issue (query B)

 

Sample Location: SfDataGrid.zip

Video Location: Video.zip

 

Please let us know if you need further assistance.

 

Regards,

Prakash S.



BS bhavani sangannagari April 8, 2013 08:46 PM UTC

Prakash, 

In your sample, to reproduce, please place line " GDCSource.Clear();  " in the setter for property Limit before for loop. This must display selected number of records in the grid. Now run the solution. 
Steps 
a) Select 5 in combo to display 5 records. 
b) Next select 0 in combo box to display 0 records. [Note grid does not refresh to show 0 records]. clicking on any un-refreshed row results in exception

Please let me know how to refresh grid with empty records. 

Thanks


PS Prakash Selvaraj Syncfusion Team April 9, 2013 07:37 AM UTC

Hi Bhavani,

 

Sorry for this inconvenience caused.

 

We have analysed your query, we are able to reproduce the issue. Please follow the incident id 106676 for further technical support on the reported issue.

 

Regards,

Prakash S.


Loader.
Live Chat Icon For mobile
Up arrow icon