I followed the documentation, however, the example uses the default EditMode.Dialog. In my implementation, I am customizing my edit dialog to only show the fields I want to edit and to change the header. Here is my grid .razor code.
<SfGrid @ref="@Grid" DataSource="@OrderLineItemData" Height="100%" Width="100%">
<GridEvents OnActionBegin="ActionBeginHandler" TValue="OrderLineItem"></GridEvents>
<GridEditSettings AllowEditing="true" Dialog="DialogParams" Mode="EditMode.Dialog">
<Template>
@{
var lineItem = (context as OrderLineItem);
<div width="400px">
<div class="row">
<div class="col-12">
<div class="form-group">
<label>Product</label>
<SfTextBox ID="Product" Value="@(lineItem.ProductName)" Enabled="false"></SfTextBox>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group">
<label>Qty</label>
<SfNumericTextBox ID="Quantity" Value="@(lineItem.Quantity)" Enabled="true" ShowSpinButton=false Format="n0"></SfNumericTextBox>
</div>
</div>
</div>
</div>
}
</Template>
</GridEditSettings>
<GridColumns>
<GridColumn HeaderText="" Width="150" AllowEditing="false">
<Template>
@{
var lineItem = (context as OrderLineItem);
}
<button class="btn btn-outline-primary btn-sm" type="button" title="Increase qty by 1"
@onclick="@(_ => { if (context != null) HandleQtyIncrease(lineItem);})">
<span class="fas fa-plus"></span>
</button>
<button class="btn btn-outline-primary btn-sm" type="button" title="Decrease qty by 1"
@onclick="@(_ => { if (context != null) HandleQtyDecrease(lineItem);})">
<span class="fas fa-minus"></span>
</button>
@if (lineItem.Quantity > 0)
{
<button class="btn btn-outline-danger btn-sm" type="button" title="Reset qty to 0"
@onclick="@(_ => { if (context != null) HandleQtyClear(lineItem);})">
<span class="fas fa-times"></span>
</button>
}
</Template>
</GridColumn>
<GridColumn Field=@nameof(OrderLineItem.Quantity) HeaderText="Qty" Width="75px" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Center"> </GridColumn>
<GridColumn Field=@nameof(OrderLineItem.ProductName) HeaderText="Product" AllowEditing="false"></GridColumn>
<GridColumn Field=@nameof(OrderLineItem.UnitPrice) HeaderText="Each" Format="C2" Width="100px" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right" AllowEditing="false"></GridColumn>
<GridColumn Field=@nameof(OrderLineItem.Discount) HeaderText="Discount" Format="C2" Width="100px" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right" AllowEditing="false"></GridColumn>
<GridColumn Field=@nameof(OrderLineItem.Total) HeaderText="Extended" Format="C2" Width="100px" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right" AllowEditing="false"></GridColumn>
</GridColumns>
</SfGrid>
And here is my DialogParams property from the .razor.cs file;
protected object DialogParams { get; set; } = new
{
@params = new DialogModel
{
Header = "Edit Product Quantity",
Width = "400px",
},
};
I have attached a set of screenshots, as follows;
EditMode.Dialog_Screenshot1_05082020_1024a.png - This shows the Edit Dialog popup when I double-click on the first row of the grid. Note the customized header text and the fact that I am only showing the ProductName and Quantity fields with the ProductName as readonly.
EditMode.Dialog_Screenshot2_05082020_1025a.png - This shows me typing in a quantity value in thee Qty field.
EditMode.Dialog_Screenshot3_05082020_1026a.png - This shows what happens after I click the Save button. Note that the first row has been updated, behind the Edit Dialog and that the Qty field in the edit dialog box is empty, but the dialog itself did not close. I have to then click on the Cancel button to close the dialog.
I thought that, perhaps, the problem was caused by the template so I commented out the the <GridEditSettings> --> <Template> section and removed the Dialog="DialogParams" property so that the default Edit dialog would appear but I still have the same problem.
I also tried commenting out the <GridEvents> component, since your example doesn't have one. However, when I do that, the row doesn't update at all and the Edit dialog still does not close when I click on Save.
I am not seeing where the problem can be coming from.
Attachment:
SyncFusion_Screenshots_446ef3aa.zip