Sorting template columns #348
-
|
I can't currently find a way to sort template columns by clicking on the header. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
When you create a column, the constructor takes a |
Beta Was this translation helpful? Give feedback.
-
|
Here’s what I used to sort a FileName column:
```
TemplateColumnOptions<MyFile> FileColOptions = new()
{
CanUserSortColumn = true,
CompareAscending = (x, y) => string.Compare(x?.FileName, y?.FileName, StringComparison.CurrentCultureIgnoreCase),
CompareDescending = (x, y) => string.Compare(y?.FileName, x?.FileName, StringComparison.CurrentCultureIgnoreCase)
};
```
James
|
Beta Was this translation helpful? Give feedback.
When you create a column, the constructor takes a
ColumnOptionsparameter that contains theCompareAscending,CompareDescending, andCanUserSortColumnproperties. Which probably should do what you are looking for.