Hi there
Then when you try to show the column the grid does not show the column till you click a row in the grid.
The same is behavior happening when you add an item model to the toolbar to save the grid state. Edit a cell click away and reset the state of the grid and the reset does not happen till you click in a non-editable column
I am attaching gifs to reproduce the issues.
Also Attaching a demo project to reproduce all the described issues
Also Attaching a demo project to reproduce all the described issues
|
<SfGrid ID="Grid" @ref="GridInstance" AllowPaging="true" DataSource="@Orders" AllowReordering
Toolbar="@(new List<Object>() { "Cancel", "Update", "ColumnChooser",
new ItemModel() { Text = "Reset",PrefixIcon = "e-click", Id = "Reset" },
new ItemModel() { Text = "SaveState",PrefixIcon = "e-click", Id = "Save" }})"
ShowColumnChooser="true">
<GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Both"></GridSelectionSettings>
<GridEditSettings AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
<GridEvents Created="Created" CellSelected="CellSelectHandler" OnActionComplete="ActionComplete" OnActionBegin="ActionBegin" OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120" IsPrimaryKey></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" EditType="EditType.DatePickerEdit" Format="d" TextAlign="TextAlign.Right" Width="130" Type="ColumnType.Date"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" EditType="EditType.NumericEdit" Width="120" AllowEditing="false"></GridColumn>
<GridColumn Field=@nameof(Order.ShipCountry) HeaderText="Ship Country" Width="150" AllowEditing="false"></GridColumn>
</GridColumns>
</SfGrid>
@code{
SfGrid<Order> GridInstance { get; set; }
private string _state;
public async Task ActionBegin(ActionEventArgs<Order> Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.ColumnState)
{
if (GridInstance.IsEdit)
{
await GridInstance.CloseEditAsync();
}
}
}
public void ActionComplete(ActionEventArgs<Order> Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.ColumnState)
{
GridInstance.Refresh();
}
}
. . . . .
public void ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)
{
if (args.Item.Id == "Reset")
{
// check whether the grid is in edit state
if (GridInstance.IsEdit)
{
// call close edit to discard the changes and revert to its state
GridInstance.CloseEditAsync();
}
GridInstance.ResetPersistData();
}
if (args.Item.Id == "Save")
{
GridInstance.SetPersistData(_state);
}
}
|