When using the HeaderTemplate feature grid headers will disappear after reordering columns.
This does not happen without the template.
@page "/test"
@using Microsoft.Extensions.Primitives
<h1>My Grid</h1>
<p>This component demonstrates fetching data from a service.</p>
@if (orders==null)
{
<p><em>Loading...</em></p>
}
else
{
<EjsGrid DataSource="@orders" @ref="Grid" AllowReordering="true" AllowResizing="true" AllowSorting="true">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Normal"></GridEditSettings>
<GridColumns>
<GridColumn Field="Id" IsPrimaryKey="true" TextAlign="TextAlign.Left" Width="120">
<HeaderTemplate>Id</HeaderTemplate>
</GridColumn>
<GridColumn Field="Customer" IsPrimaryKey="true" TextAlign="TextAlign.Left" Width="120" >
<HeaderTemplate>Customer</HeaderTemplate>
</GridColumn>
</GridColumns>
</EjsGrid>
}
@code {
public class Order
{
public int Id { get; set; }
public string Customer { get; set; }
}
private List<Order> orders;
EjsGrid<Order> Grid;
protected override async Task OnInitializedAsync()
{
orders = new List<Order>()
{
new Order()
{
Id = 1,
Customer = "John"
},
new Order()
{
Id = 2,
Customer = "Sara"
}
};
}
}