Access the Cahnged Data of Grid

In a Vue.js application, I have a Syncfusion Data Grid which is bound to a remote data. The Edit mode set to 'Batch'.

In the Data Grid, I have a computed column. That means it must recalculate every time that some fields have been changed. To recalculate that I need all data in the grid.

When I use getDataModule it gives me initial data that not include changed data by the user. 

How can I access all data in the Grid include changed data?

Thanks


3 Replies

TS Thiyagu Subramani Syncfusion Team February 12, 2021 12:55 AM UTC

Hi Fereydoon, 

Thanks for contacting Syncfusion support. 

Based on your shared information we would like to inform while using remote data in Grid, Grid works based on the on-demand concept so Grid will have access to the current page records only with page that is Grid can bind only current page records based on pageSize property. However, after moving to other pages and return to that page records. In Local data Grid will have access to the entire DataSource.  This is the default behavior of Grid component. Due to the above behavior it is not feasible to get the all Grid data while using Remote Data.  
 
But we can get the changed, Added and deleted records from our getBatchChanges() method before updating changes to the Grid. 
 
 
If we misunderstood your requirement, please share your issue via video demonstration or share issue reproducing sample to us, then only we provide the appropriate solution as soon as possible. 

Please get back to us, if you need further assistance. 

Regards, 
Thiyagu S 



FK Fereydoon Karimi February 15, 2021 03:23 PM UTC

This API https://ej2.syncfusion.com/javascript/documentation/api/grid/#getbatchchanges doese not support my requirement.
Actually, I need the current page data, includes Added and Edited.

Another question, how I can change the data of a field by code? 


If you have a better idea to implement bellow requirement let me know.
I have a grid that shows accounting records, each row has inAmount, outAmout and Balance. The balance must be calculated automatically by (Previous Row Balance + inAmount - outAmount)

So, when any inAmount or outAmount is changed, first of all, I need the previous row data to calculate current row balance. After it, I need to update all next rows with the new balance.

P.S: I set allowPaging to false, so whole data are shown.


PG Praveenkumar Gajendiran Syncfusion Team February 16, 2021 05:44 PM UTC

Hi Fereydoon,

Thanks for your update.

Query1: “Actually, I need the current page data, includes Added and Edited.”

Based on your query, we suggest you to use
getCurrentViewRecords method of Grid using which you can get all current page data of Grid(what you have returned from your database). Please refer the below API document for getCurrentViewRecords method of Grid 

API Link:
https://ej2.syncfusion.com/vue/documentation/api/grid/#getcurrentviewrecords

If this is not meet your requirement , could you please explain/elaborate with more details about your requirement. 

Query2: “Another question, how I can change the data of a field by code?”

We suspect that your requirement is to change/update the row data value by method. For this we suggest you to use setRowData method of Grid to achieve your requirement.

You can update and refresh the particular row values by using setRowData method of Grid.
Please refer the below API document for setRowData method of Grid 

API Link:
https://ej2.syncfusion.com/vue/documentation/api/grid/#setrowdata

Query3: “I have a grid that shows accounting records, each row has inAmount, outAmout and Balance. The balance must be calculated automatically by (Previous Row Balance + inAmount - outAmount)”
 
We are not able to clearly understand your requirement from the provided information. So please share us the following additional details to validate further on this, 
  1. Do you wish to calculate the balance in each row?
  2. Do you have the balance column in your Grid dataSource?
  3. Let us know what you mean about previous row data?, then how did you calculate the first row in the Grid?
  4. Do you expect your requirement same like Grid Aggregates?
    Grid Aggregates documentation: https://ej2.syncfusion.com/vue/documentation/grid/aggregates/
  5. Explain your exact requirement with more details.

If your requirement does not come under the above, please elaborate on it with more details based on which we will check from our end and provide the further details. 
 

Regards,
Praveenkumar G
 


Loader.
Up arrow icon