Hey guys, I have a question.
I want to display the same property (BirthDay) in 2 different GridColumns with different formats in my Grid. For some further operations i really need different field names! We use Grid.GetColumnByField at some points, so we can not have the same field names.
like:
<GridColumn Field=@nameof(OverviewData.BirthDay) HeaderText="BirthDate" TextAlign="TextAlign.Right" @ref=RefToColumn Width="160"></GridColumn>
<GridColumn Field=@(nameof(OverviewData.BirthDay) + ".Date") Format="date" HeaderText="BirthDate.Date" TextAlign="TextAlign.Right" @ref=RefToColumn Width="160"></GridColumn>
That's why I was thinking about complex binding, but i am not sure if this is how it works and if it even works with DateTime? properties.
I've added a testproject, the grid can be found in "SfGridTest.razor". Can you help me find a solution for this?
Best regards
Patrick
Format="date" and Format="date-time" works fine.
This is what I want, one column with "01.01.2021 15:16" and another with just "01.01.2021".
But I NEED them to have different Field values!
As I said we use GetColumnByField at some points to apply custom filtering, grouping and ordering for example. And if two fields have the same Field value I don't know which one I am acutally displaying. Sure the filtered value is the same, but the columns have different HeaderTexts and i display the HeaderText so the people know what they are grouping/filtering and stuff.
That's why i tried complex binding, just to have different Field values for the columns. But I don't know if this works or maybe you have another solution for this. I need a persistent and unique identifier for the columns.
Sorry for the misscommunication and the weird case.
|
@*Displays only day value of BirthDay*@
<GridColumn Field=@nameof(OverviewData.BirthDay) HeaderText="BirthDate" Format="dd" ...></GridColumn>
@*Displays BirthDay as date and month*@
|