Can't stop in place edit Releases 58/59

Use the below code.  Double click to edit a cell.  I can't come up with anything to "stop editing".  I already have a bug report for clicking out of the row not stopping the edit, but as of build 58 the enter key no longer works to save the row.  Please fix ASAP.

@page "/"
@using Syncfusion.Blazor.Grids
@using Syncfusion.Blazor.Buttons

<SfButton OnClick="@(async () => _state = await Grid.GetPersistData())">Save State</SfButton>
<SfButton OnClick="@(() => Grid.SetPersistData(_state))">Set State</SfButton>
<SfButton OnClick="@(() => Grid.ResetPersistData())">Reset State</SfButton>
<div style="        height: 90vh;
        width: calc(100vw - 250px) !important;">
    <SfGrid @ref="Grid" ID="GridOneTwo" DataSource="@Orders" Width="100%" Height="100%" EnablePersistence="true" AllowPaging="true" AllowFiltering="true" AllowGrouping="true" AllowSorting="true" AllowReordering="true" AllowResizing="true">
        <GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Row" CheckboxOnly="true"></GridSelectionSettings>
        <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="Syncfusion.Blazor.Grids.EditMode.Normal"></GridEditSettings>
        <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings>
        <GridColumns>
            <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right"></GridColumn>
            <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name"></GridColumn>
            <GridColumn Field=@nameof(Order.OrderDate) HeaderText="Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right"></GridColumn>
            <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right"></GridColumn>
        </GridColumns>
    <GridTemplates>
        <DetailTemplate>
            TEST
        </DetailTemplate>
    </GridTemplates>
    </SfGrid>
</div>

@code {
    SfGrid<Order> Grid;

    public List<Order> Orders { get; set; }

    public string _state;

    protected override void OnInitialized()
    {
        Orders = Enumerable.Range(1, 75).Select(x => new Order()
        {
            OrderID = 1000 + x,
            CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
            Freight = 2.1 * x,
            OrderDate = DateTime.Now.AddDays(-x),
        }).ToList();
    }

    public class Order
    {
        public int? OrderID { get; set; }
        public string CustomerID { get; set; }
        public DateTime? OrderDate { get; set; }
        public double? Freight { get; set; }
    }
}

3 Replies

VN Vignesh Natarajan Syncfusion Team September 25, 2020 04:51 AM UTC

Hi Jonah,  
 
Thanks for contacting Syncfusion support.  
 
Query: “ Double click to edit a cell.  I can't come up with anything to "stop editing" 
 
We have analyzed the reported query and we are able to reproduce the reported behavior at our end while preparing a sample using your code example. To perform Editing action in Grid, PrimaryKey column be defined. (i.e.) IsPrimaryKey property must be defined to any one of the available columns whose value is unique.  Based on PrimaryKey column value, only CRUD (i.e.) Edit, delete, Insert action will take place. 
 
But in the provided code example, PrimaryKey column is not defined. Hence the reported issue has occurred. We suggest you to define IsPrimaryKey property to any one of the available column whose value is unique. Refer our UG documentation for your reference 
 
 
Refer the below modified code example.  
 
<SfGrid @ref="Grid" ID="GridOneTwo" DataSource="@Orders" Width="100%" Height="100%" EnablePersistence="true" AllowPaging="true" AllowFiltering="true" AllowGrouping="true" AllowSorting="true" AllowReordering="true" AllowResizing="true"> 
        <GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Row" CheckboxOnly="true"></GridSelectionSettings> 
        <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="Syncfusion.Blazor.Grids.EditMode.Normal"></GridEditSettings> 
        <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings> 
        <GridColumns> 
            <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right"></GridColumn> 
            <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name"></GridColumn> 
            <GridColumn Field=@nameof(Order.OrderDate) HeaderText="Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right"></GridColumn> 
            <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right"></GridColumn> 
        </GridColumns> 
        <GridTemplates> 
            <DetailTemplate> 
                TEST 
            </DetailTemplate> 
        </GridTemplates> 
    </SfGrid> 
 
 
Please get back to us if you have further queries.        
 
Regards, 
Vignesh Natarajan 



JC Jonah Coleman September 25, 2020 01:05 PM UTC

OK, yes true.  I'm trying to give a repro script of a much larger grid that does have a primary key though.

Try this one below, seems to be any grid with a column that doesn't have a field assigned.  The console error looks like this:

And again, began with release 58.

@page "/"
@using Syncfusion.Blazor.Grids
@using Syncfusion.Blazor.Buttons

<SfButton OnClick="@(async () => _state = await Grid.GetPersistData())">Save State</SfButton>
<SfButton OnClick="@(() => Grid.SetPersistData(_state))">Set State</SfButton>
<SfButton OnClick="@(() => Grid.ResetPersistData())">Reset State</SfButton>
<div style="        height: 90vh;
        width: calc(100vw - 250px) !important;">
    <SfGrid @ref="Grid" ID="GridOneTwo" DataSource="@Orders" Width="100%" Height="100%" EnablePersistence="true" AllowPaging="true" AllowFiltering="true" AllowGrouping="true" AllowSorting="true" AllowReordering="true" AllowResizing="true">
        <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="Syncfusion.Blazor.Grids.EditMode.Normal"></GridEditSettings>
        <GridColumns>
            <GridColumn Type="ColumnType.CheckBox" Width="50" ShowInColumnChooser="false"></GridColumn>
            <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right"></GridColumn>
            <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name"></GridColumn>
            <GridColumn Field=@nameof(Order.OrderDate) HeaderText="Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right"></GridColumn>
            <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right"></GridColumn>
            <GridColumn HeaderText="TEST">
                <Template>
                    TEST
                </Template>
            </GridColumn>
        </GridColumns>
    <GridTemplates>
        <DetailTemplate>
            TEST
        </DetailTemplate>
    </GridTemplates>
    </SfGrid>
</div>

@code {
    SfGrid<Order> Grid;

    public List<Order> Orders { get; set; }

    public string _state;

    protected override void OnInitialized()
    {
        Orders = Enumerable.Range(1, 75).Select(x => new Order()
        {
            OrderID = 1000 + x,
            CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
            Freight = 2.1 * x,
            OrderDate = DateTime.Now.AddDays(-x),
        }).ToList();
    }

    public class Order
    {
        public int? OrderID { get; set; }
        public string CustomerID { get; set; }
        public DateTime? OrderDate { get; set; }
        public double? Freight { get; set; }
    }
}


VN Vignesh Natarajan Syncfusion Team September 28, 2020 09:44 AM UTC

Hi Jonah, 
 
We have validated the query with the provided details and we are able to reproduce the reported issue at our end. Since it is a known issue, we have already confirmed it is a bug and logged the defect report for the same “Exception is thrown while saving the changes in grid with CommandColumns”. Fix for the issue will be included in our 2020 Volume 3 release which is expected to be rolled out by month end of September 2020.          
    
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.        
    
   
Till then we appreciate your patience.     

Regards,  
Vignesh Natarajan 


Loader.
Up arrow icon