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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

108132 Apr 4,2013 04:26 PM Apr 9,2013 03:37 AM WinRT 5
loading
Tags: SfDataGrid
bhavani sangannagari
Asked On April 4, 2013 04:26 PM

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 

Prakash Selvaraj [Syncfusion]
Replied On April 5, 2013 06:54 AM

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.

 


bhavani sangannagari
Replied On April 5, 2013 12:04 PM

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.


Prakash Selvaraj [Syncfusion]
Replied On April 8, 2013 07:56 AM

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.


bhavani sangannagari
Replied On April 8, 2013 04:46 PM

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

Prakash Selvaraj [Syncfusion]
Replied On April 9, 2013 03:37 AM

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.


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.

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.

;