I'm using blazor server side 19.3
I tried to add in one of your sample, a custom comparer for a datagrid where I use a datamanager but it's never called
How can I add a custom comparer in a datagrid with Datamanager ?
I received your support for another request ( Filtering data by RegExp | Blazor Forums | Syncfusion) where you suggested to use the "customadaptor" to solve my specific problem where a column contains data like
1
2
1NA
1TER
....
and where I needed to filter only the "numeric" data.
using your suggestion and the customadaptor, the filter is working fine but then the sorting is not working because the column data is a string type so even if I filter only "numeric" values they are showed not in the correct order.
The only solution I think is to use a custom comparer converting the data to interger type after filtering only the "numeric" values but how can do this job if the custom comparer can't be used ?
Thanks
Thanks for your suggestion, I supposed to use this way but I didn't know how the Read method actually works
This is the perfect solution for any type of string content in "Numfatt" value
if (dm.Sorted != null && dm.Sorted.Count > 0)
{
if (dm.Sorted[0].Name == "Numfatt")
{
int maxlen = DataSource.Max(x => x.Numfatt.Length);
if (dm.Sorted[0].Direction == "ascending")
DataSource = DataSource.OrderBy(c => c.Numfatt.Length).ThenBy(c => c.Numfatt.PadLeft(maxlen, '0')).ToList();
else
DataSource = DataSource.OrderByDescending(c => c.Numfatt.Length).ThenByDescending(c => c.Numfatt.PadLeft(maxlen, '0')).ToList();
}
else
{
// Sorting
DataSource = DataOperations.PerformSorting(DataSource, dm.Sorted);
}
}