Sfdatagrid grouping compiler error

I have Sfdatagrid bound to an observable collection. It works fine. I am trying to group by Country programmatically using the following code:

GroupColumnDescription myGrouping = new GroupColumnDescription();

myGrouping.ColumnName = "Country";

myGrid.GroupColumnDescriptions.Add(myGrouping);

But on the last line, the compiler throws error "SelectedCellInfo can't be null in Remove".

The following code for sorting the column works as expected, so I do not understand why grouping throws an error.

SortColumnDescription mySorting = new SortColumnDescription();

mySorting.ColumnName = "Country";

mySorting.SortDirection = ListSortDirection.Ascending;

myGrid.SortColumnDescriptions.Add(mySorting);

Grouping is enabled on the grid. I am using .NET Framework 4.8.

Any ideas?




5 Replies

BT Balamurugan Thirumalaikumar Syncfusion Team June 30, 2021 12:18 PM UTC

Hi tradecode,  
  
Thank you for contacting Syncfusion support.  
  
We have checked your query at our end. Based on provided replication scenario we have tried to reproduce the reported scenario, but it is working as expected at our end. The sample we have used to check this scenario is available in the following link for your reference.   
 
 
Please have a look at this sample and let us know if we have missed any customization you have done in your application. Otherwise try to reproduce the reported issue in this sample and revert to us with the modified sample. It will be more helpful for us to find the exact cause for the issue and to provide a prompt solution at earlier.  
 
Please let us know if you require further assistance from us.  
 
Regards  
Balamurugan.Thirumalaikumar  
 



TR tradecode June 30, 2021 10:49 PM UTC

Thank you. The file you sent runs fine. It appears the exception is thrown when my bound collection is empty and there is nothing to group.

In my app, my collection remains empty until info is received from a remote server. I can get grouping to work if I put in a suitable thread sleep before the grouping code is called. This feels cheap and not optimal, but it works. 

My main problem now is that the order of my grouping is reversed from what I want (ascending vs descending). Is there a way to specify the Group sort order programmatically? I don't see this in the docs.

I don't want to show the Group Drop Area, which I recognize allows me to do it manually.


Thank you again!



BT Balamurugan Thirumalaikumar Syncfusion Team July 1, 2021 01:11 PM UTC

Hi tradecode, 
 
Thank you for your update. 
 
We have checked your query “Is there a way to specify the Group sort order programmatically?” at our end. In order to achieve your requirement you can programmatically change the SortColumnDescription’s SortDirection as either ascending or descending. Please refer the following sample for your reference. 
 
 
Regards 
Balamurugan.Thirumalaikumar 
 



TR tradecode July 8, 2021 07:59 PM UTC

Thank you.



MA Mohanram Anbukkarasu Syncfusion Team July 9, 2021 05:04 AM UTC

Hi tradecode, 

Thanks for the update.  

Please let us know if you require any other assistance from us.  

Regards, 
Mohanram A. 


Loader.
Up arrow icon