We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

context in DetailTemplate for Added or Changed Records

Hi

I have a SfGrid using EditMode.Batch with a DetailTemplate.

For any changed rows, the context for the DetailTemplate shows the old record rather than changed one.

So for a newly added record, any changes that were made in the OnBatchAdd event callback are shown correctly in the context in DetailTemplate but any changes that were made by editing columns in the grid (or programmatically) are not.

Please advise on how to access or get the changed record?

Sohaib


3 Replies

SP Sarveswaran Palani Syncfusion Team October 24, 2022 07:54 AM

Hi Sohaib,


Greetings from Syncfusion support.


We have analyzed your query and suspect that you want to get the values of chaged records. If so we suggest you to use GetBatchChanges method of DataGrid. It will contain the changed records from the batch edit. Kindly get back to us if you have any further queries.


Regards,

Sarveswaran PK




SU Sohaib Uthmani replied to Sarveswaran Palani November 1, 2022 10:45 AM

Hi Sarveswaran

Thank you for your reply.

The solution you describe by using GetBatchChanges will not work when there are more than 1 new items. This is because the id of the newly added items is 0, and we are unable to determine which specific Added record in GetBatchChanges the DetailTemplate is referring to.

The only solution to this is by using a temporary index that we add to each class. The index then has to be managed as well leading to a very inelegant solution.

Since the grid is managing the mapping between the rows original record and the changed record, the best solution would be for the DetailTemplate to refer to the changed record AND the original record.

Sohaib



SP Sarveswaran Palani Syncfusion Team November 1, 2022 12:42 PM

Hi Sohaib,


Thanks for an update.


Based on your query, we suspect that you issue has been resolved by some work around.


If still you’re facing anu issue, please get back to us.


Regards,

Sarveswaran PK


Loader.
Live Chat Icon For mobile
Up arrow icon