I using SfDataManager Adaptor="Adaptors.CustomAdaptor" AdaptorInstance="typeof(...)" override methods (RemoveAsync, InsertAsync, UpdateAsync). How do i get the object that each of these methods returns&
Hi Kavit,
Greetings from Syncfusion support.
We suspect that you are expecting to get the changed/updated record details. If so we would like to inform that Action complete event will be triggered after performing CRUD operation and we can get details in the action event argument. Kindly check the below UG for your reference.
Reference: https://blazor.syncfusion.com/documentation/datagrid/events#onactioncomplete
If we misunderstood your query 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
Hi Kavit,
We suggest you to use below solution to overcome the reported issue. Here we have customized the data from the parameter so that we can get the customized data at our Action event argument. Kindly check the attached code snippet and sample for your reference.
public override async Task<object> InsertAsync(DataManager dataManager, object data, string key) { //Order order = new Order { CustomerID=(data as Order).CustomerID, OrderID=123, Freight=123}; //Orders.Add(order); //return order;
Order val = data as Order; val.OrderID = 123; val.Freight = 123; Orders.Add(data as Order); return data; } |
Please let us know if you have any concerns.
Regards,
Monisha
Yes, your example works. Yet. It became interesting to me Why it is impossible to return new object?
// I got it right?
var test = new TestRef();
ChangeTestStr(test);
PrintTestStr(test);
void ChangeTestStr(TestRef test)
{
test.TestStr = "123";
}
void PrintTestStr(TestRef test)
{
Console.WriteLine(test.TestStr);
}
public class TestRef
{
public string TestStr { get; set; }
}
Hi Kavit,
We would like to inform that the InsertAsync method will update the Grid once it is rendered so the newly returned values will not be reflected in ActionComplete. So we suggest you to make use of existing variable to reflect the changes in ActionComplete event.
Please let us know if you have any concerns.
Regards,
Monisha