await GridDetail.UpdateCell(RowIndexDetail, "LotNoId", _lotnoid); is not working
After clicking the save button it will automatically display grid details.
Like this:
Not this:
Hi Belle,
Greetings from Syncfusion support.
We have analyzed your query and we suspect that you are using UpdateCell method with dialog mode of edit. If So we would like to inform that UpdateCell method will work only in Batch mode of edit. Instead of using UpdateCell method we suggest you to use UpdateRowAsync method to update the edited data to the DataGrid. Kindly check the attached code snippet for your reference.
|
<SfGrid DataSource="@Orders" @ref="Grid" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })"> </SfGrid>
@code{ public List<Order> Orders { get; set; } public SfGrid<Order> Grid;
private async Task OKCloseDialog() { SelectedProduct.Remarks = TextBoxRef.Value; await this.Grid.UpdateRowAsync(selectedIndex, SelectedProduct); // update the row using method this.IsVisible = false; } } |
Also we would like to inform the you can use Action events of Grid to modify the data. It will trigger for every CRUD operation. By using request type of action event you can find and perform your own action.
Reference: https://blazor.syncfusion.com/documentation/datagrid/events#onactionbegin
Kindly get back to us if you have further queries.
Regards,
Monisha
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.
protected async Task ConfirmLotNoAdd_Click(int _lotnoID) //August 8, 2022
{
if (_lotnoID != 0)
{
await Task.Delay(200);
LotNumbers = (await LotNumberService.GetLotNumbers()).ToList(); //Fetch the selected records
await GridDetail.UpdateCell(RowIndexDetail, "LotNoId", _lotnoID);
StateHasChanged();
}
}
It gives me this result:
I want to display in the data grid the latest added LotNo which is "sample1":
I am currently using the Batch mode.
Hi Belle,
Thanks for the update.
We have checked your query and we suspect that the LotNo column is an integer column and you are trying to save an string value while adding new columns. If so we suggest you to use column template feature of DataGrid for display purpose. You can store the entered value in the local variable and you can use them inside the column template. Also we could see that in your shared method(ConfirmLotNoAdd_Click) you have passed integer value as an argument and it is used inside the update cell method. Also we suggest you to use value change event for the LotNo column while adding so that it triggers when the value is changed and we can get the corresponding changed value in the event args.
Reference: https://blazor.syncfusion.com/documentation/datagrid/column-template
If the reported issue still persist then kindly share the below details to validate further at our end.
The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.
Regards,
Monisha