w-ahmad / WinUI.TableView

A light weight TableView component for WinUI3
MIT License
123 stars 8 forks source link

Sortable Date Columns #26

Open Bush-cat opened 2 months ago

Bush-cat commented 2 months ago

Is your feature request related to a problem? Please describe. I use a localized DateOnly in my Table but Sorting is broken because of the Date format DD/MM/YYYY.

Describe the solution you'd like Make TextColumns respect Date classes or maybe make a DateColumn that can work with Date variables

Describe alternatives you've considered Some way to implement sorting into a TextColumn yourself, this would also be usefull in other Cases, where I have an Icon next to my Text, there I couldn't use a TextColumn and decided to use two Columns instead, one for the icon, the other for the text.

VisualAlf commented 1 month ago

IMHO the easiest way for this is to use a converter. If you have eg. a numeric as the underlying datatype it will be sorted correctly, regardless of the displayed text format. See the SampleApp for usage with a DateTimeOffset.

Bush-cat commented 1 month ago

IMHO the easiest way for this is to use a converter. If you have eg. a numeric as the underlying datatype it will be sorted correctly, regardless of the displayed text format. See the SampleApp for usage with a DateTimeOffset.

Converter could work, sadly Converters do not work with the Filter Menu, it shows the items without any conversion Maybe the new template controls in v1.2.0-preview2 can do it. More TemplateColumn properties would help a lot. I'm a bit struggling with localization in winui, I tried many ways already but they all suck in some way.

w-ahmad commented 1 month ago

You are correct, @Bush-cat; converters are not considered for sorting and filtering. Would it be suitable for you if the filter and sort methods use converters to get the final values?

w-ahmad commented 1 month ago

Date column is planned for v1.3, I'll share the roadmap soon.

Bush-cat commented 1 month ago

You are correct, @Bush-cat; converters are not considered for sorting and filtering. Would it be suitable for you if the filter and sort methods use converters to get the final values?

Converters for those would be nice