Columns without Field are not all appearing
Closed this issue · 1 comments
RexTremendae commented
Steps to reproduce
Create a new Blazor Server project and add the following code to any page:
<BlazmGrid Data="@Items">
<GridColumns>
<GridColumn Title="First">
<Template>
<span>1st static content</span>
</Template>
</GridColumn>
<GridColumn Title="Second">
<Template>
<span>2nd static content</span>
</Template>
</GridColumn>
<GridColumn Field="Key" />
<GridColumn Field="Value" />
</GridColumns>
</BlazmGrid>
@code {
public KeyValuePair<int, string>[] Items = new[]
{
new KeyValuePair<int, string>(1, "#1"),
new KeyValuePair<int, string>(2, "#2"),
new KeyValuePair<int, string>(3, "#3")
};
}
Actual result
Running the above code will yield the following result:
Expected result
I would expect to get the second static content string printed out in the column titled 'Second', and all the following columns aligned correctly to each title.
Code
The problem seems to be the identification of the columns in BlazmGrid.razor.cs when there is no Field or Format specified:
EngstromJimmy commented
Solved by using Id (instead of field).
Every column must have a unique name either by field or by setting the Id.