Hi,
i made generic grid which inherit from SfGrid and made custom edit dialog which is generated. Because it is generated a dont bind inside components directly to grid entity but to my custom entities. Problem i have is that when i click on save button, changes that were made in my custom edit dialog are not saving to the row entity and are not send to the API in PUT request(old entity is send). Im using remote data binding with ODataV4Adaptor. Is it possible to manully update the edited entity or give the grid entity to be send in PUT request?
Hi Ladislav,
We suspect that you are expecting to update the record in Grid bus using an button click from customized dialog. If so we suggest you to use UpdateCellAsync/ SetRowData methods to update the Grid row. It will update the record as per the passed value in arguments.
If we misunderstood your query or if you have further queries then kindly share the below details to proceed further at our end.
Above requested details will be very helpful in validating the reported query at our end and provide solution as early as possible.
Regards,
Monisha
Thanks, that was what i needed. I have two more problems, im doing SetRowDataAsync in OnActionBegin event for Action.Save. But the same event is called when button Save is clicked from Add or Edit dialog, is it possible to distinguish the dialog type(Add/Edit) from something? Second problem is same as my original question but for Add, when SetRowDataAsync is called, inside the method PUT request is sent. For adding i only found AddRecordAsync, but inside this method no POST request is sent. Do i need to call another method? In both scenarios Add/Edit im setting property Cancel = true on OnActionBegin event argument because i dont want the original Save logic to run.
Hi Ladislav,
Query: “is it possible to distinguish the dialog type(Add/Edit) from something? ”
Yes, we can use Action from the argument to differentiate between Add and Edit operations. Kindly check the below attached code snippet for your reference.
public void ActionBeginHandler(ActionEventArgs<Order> args) { if (args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.Save)) { if (args.Action == "Add") { // it triggers when we click save button after performig Add } else if(args.Action == "Edit") { // it triggers when we click save button after performing Edit } }
} |
For adding i only found AddRecordAsync -> For adding we have only AddRecordAsync method, for updating we can use UpdateRowAsync method
Regards,
Monisha
Thanks for response. Problem with manually adding new record with AddRecordAsync is that it will not call POST request to server. When UpdateRowAsync is used it will call PUT/PATCH request to server and after that i can call sfGrid.Refresh() and it looks same as the default Save logic. But AddRecordAsync just adds new record to the grid and nothing else is happening, i cant call SetRowDataAsync on the new record because it doesnt have generated Id from server.
I resolved the issue with adding by not calling AddRecordAsync but in OnActionBegin i just assign my new entity to args.Data and dont skip the event and it works.
Hi LadiSlav,
We are glad to hear that the reported issue resolved on your own. Kindly get back to us if you need further assistance. As always we will be happy to help you.
Regards,
Monisha