I am trying to change the order that True and False come in a table using a column type of Boolean.I want False to come first. Here is the code:
<Table
DataSource="ObjectModel"
Loading="IsLoading"
TItem="DataModel"
RemoteDataSource >
<Column TData="bool"
Title="Done"
@bind-Field="context.Done"
Sortable
Filterable/>
</Table>
Output: Find current output here
I have tried creating an enum with those types in the right order but since this snippet is part of a large codebase, it breaks a lot more things than I can fix. I am looking for a solution that won't affect any other dependencies that much.
You can create a table filter array that starts with "False". This way the "False" text will show up first, then followed with "True". Update the table to include the filter. Hope it works for you.
Code (untested):
<Table
DataSource="ObjectModel"
Loading="IsLoading"
TItem="DataModel"
RemoteDataSource >
<Column TData="bool"
Title="Done"
@bind-Field="context.Done"
Sortable
Filters="DoneFilter"/>
</Table>
@code {
private TableFilter<bool>[] DoneFilter =
{
new() {Text = "False", Value = false},
new() {Text = "True", Value = true},
};
}