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
close icon

SortComparer for DataTable items source

Hi,
I have SfDataGrid bound to DataTable with AutoGenerateColumns="True". I need to define custom sort comparer for string columns (to suport natural sorting).
Is there a way how to do it?

Thanks!

4 Replies

OS Ondrej Svoboda October 23, 2019 02:33 PM UTC

I've found the solution in the other thread: https://www.syncfusion.com/forums/121745/filter-on-the-combobox-itemssource
Converting DataTable to dynamic objects does the trick.


FP Farjana Parveen Ayubb Syncfusion Team October 24, 2019 05:32 AM UTC

Hi Ondrej, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Farjana Parveen A 



JO Johnes February 24, 2022 02:22 PM UTC

Hello Ondrej

please can you explain how dynamic objects can to support natural sorting on Sfdatagrid?

I have the same question but still don't know how dynamic objects can help.



OS Ondrej Svoboda February 24, 2022 04:25 PM UTC

Custom sort comparers are not allowed for DataTable source. So you need to first convert DataTable to dynamic objects to be able to use custom sort comparers.

Some examples can be found here: http://www.syncfusion.com/forums/121745/filter-on-the-combobox-itemssource?reply=lEJ2ue


Loader.
Live Chat Icon For mobile
Up arrow icon