Changes on grid reverted after UpdateRowAsync

Hi team,

I am using Batchmode.. What happens is when updated a row using UpdateRowAsync.. Added and deleted rows goes reverted.


here is an example..



The added row was gone after this code.


_ = GridDetail.UpdateRowAsync(RowIndexDetail, _ADdetailEdit);

GridDetail.Refresh();




by the way, I'm using customize modal component as external form adding or editing row.


hope you could help me on this matter.


Best Regards,

Tyrone


7 Replies

TY Tyrone September 21, 2022 07:13 PM UTC

Im also getting problem with AddRecordAsync.


For example I added a Row which is ID 3.



Then this is what happens when I add an another row.




ID 3 also changed based on newly added Row..


Short to say, all previous added row changes based on Newly added row..


Here is my code..


_ADdetailEdit.ID = RowCount++;

_ = GridDetail.AddRecordAsync(_ADdetailEdit);



TY Tyrone September 23, 2022 01:54 AM UTC

I'll already fixed the UpdateRowAsync problem. I applied the update cell instead.

My only trouble now is the AddRecordAsync.



NP Naveen Palanivel Syncfusion Team September 23, 2022 03:41 AM UTC

Hi Tyrone,


Greetings from Syncfusion support.


We checked your query , you facing a issue when previous added row changes based on Newly added row. We prepared sample as per requirement and attached in this ticket. Please refer the attached sample and snippet code for your reference.


Reference  : https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_AddRecordAsync__0_System_Nullable_System_Double__


 

    public void Add()

    {

        if (a == b)

        {

            a = Grid.DataSource.Count();

            b= a + 1;

            Grid.AddRecordAsync(new Order() { OrderID = b });

        }

        else

        {

            b = b + 1;

            Grid.AddRecordAsync(new Order() { OrderID = b });

        }    

 

 

    }

 


Please let us know if you have any concerns.


Regards,

Naveen Palanivel


Attachment: BlazorApp2_cccf6239.zip


TY Tyrone September 29, 2022 01:13 AM UTC

Thanks Naveen. I'll give it a try. 



NP Naveen Palanivel Syncfusion Team September 30, 2022 04:25 AM UTC



ZI Ziemann November 28, 2022 03:55 PM UTC

Hello there,

I hope I'm not bothering anyone of you two by replying to this thread, but I'm rather desperate.

I also have the mentioned issue of UpdateRowAsync() reverting changes. Above mentioned idea of updating the Cell doesn't work either.

My current implementation looks like this. The Save()-Method gets called on a button click inside a form. The SelectedItem-Object it binded to that form, so everytime the user changes something, the object knows the new value.



So the object "SelectedItem" contains the changes from the User. The method UpdateRowAsync() will then make a call to a OData-Method with the following implementation. This also works - I have debugged it in single step mode.



So far so good. But during debugging I figured out, that the patchedRule.Patch() doesn't apply the changes. When I change a field, for example 'Frequency' (which is a string-field) from 'Weekly' to 'Daily' it will still show 'Weekly' after the Patch. Upon further debugging I have noticed that the Field 'Frequency' will be in the return List of the Method GetUnchangedPropertyNames().

So it looks like the method UpdateRowAsync() will not send the changes.


Does anyone have an idea why that could be?


Thank you.



NP Naveen Palanivel Syncfusion Team November 30, 2022 05:27 PM UTC

Hi Ziemann,


We have checked your query and before proceeding further with your requirement kindly share the below details to validate further at our end.


  1. Share us the entire Grid code snippet along with model class.
  2. Share us the video demonstration of the issue with replication procedure.
  3. Please ensure  IsPrimaryKey defined in anyone column for Curd operation
  4. If possible kindly share us the issue reproduceable sample


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,

Naveen Palanivel


Loader.
Up arrow icon