BlazorTable icon indicating copy to clipboard operation
BlazorTable copied to clipboard

Sorting nullable table columns

Open LeonarddeR opened this issue 5 years ago • 1 comments
trafficstars

I have a table that contains a DateTime? column which I'd like to sort descending, however with the null values coming first. Currently, they come first if you sort ascending. It would be great if we could somehow set the sorting behavior for nullable columns in such a way that null values come first.

LeonarddeR avatar Apr 20 '20 13:04 LeonarddeR

I was able to work around this by doing the following:

public DateTime? Column { get; set; }

public DateTime ColumnNotNull => this.Column ?? DateTime.MaxValue;

Then using the ColumnNotNull property as the Field and using Column for presentation purposes.

LeonarddeR avatar Apr 22 '20 10:04 LeonarddeR