Hi Team,
I want this Refresh aggregate values in inline editing (https://ej2.syncfusion.com/react/documentation/grid/aggregates/reactive-aggregate/#refresh-aggregate-values-in-inline-editing ) in Functional Component with properly working Sum Functions.
Hi Srivathsan,
Thanks for contacting Syncfusion support.
We have prepared a sample for the requirement “Refreshing aggregate values in inline editing with Functional Component”. Please refer to the below sample link for more information.
https://stackblitz.com/edit/react-zyeher?file=index.js
Please get back to us if you need further assistance on this.
Regards,
Pavithra S
Hi Team,
Thanks for your help. It is working fine.
Regards,
Srivathsan V
Hi Team,
Is there any way to get the whole data of the table after user updates the table
Regards,
Srivathsan V
Hi Srivathsan,
You can get the updated data using the grid dataSource property if the grid is bound with local data. Also, you can get the currently viewable data after the update action using the “getCurrentViewRecords” method. Please refer to the below code example and API link for more information.
|
const getData = () => { console.log(grid.getCurrentViewRecords()); console.log(grid.dataSource); }
|
API : https://ej2.syncfusion.com/react/documentation/api/grid/#getcurrentviewrecords
If the above doesn’t meet your requirement, please share a simple sample that will be helpful for us to provide a better solution as early as possible.
Regards,
Pavithra S
Hi Pavithra,
In which place I need to call this const getData() function
const getData = () => {
console.log(grid.getCurrentViewRecords());
console.log(grid.dataSource);
}
can you add this function in this stackblitz example and Share with me
https://stackblitz.com/edit/react-zyeher?file=index.js
I need to add the edited data to a state Variable.
Is there any possibility to add a Reset Button to get Default values?
Hi Srivathsan,
Query#1: I need to add the edited data to a state Variable.
You can get the edited data inside the “actionComplete” event with “save” request type. Please refer to the below code example, API and sample link for more information.
|
const actionComplete = (args) => { if (args.requestType == 'save') { console.log(args.data); console.log(grid.getCurrentViewRecords()); console.log(grid.dataSource); } };
|
API : https://ej2.syncfusion.com/react/documentation/api/grid/#actioncomplete
Sample : https://stackblitz.com/edit/react-zyeher-fg67mb?file=index.js
Query#2: Is there any possibility to add a Reset Button to get Default values?
In EJ2 Grid, there is no option for reset the values after performing the CRUD actions. However, if you are binding a local data to the Grid, you can store the grid dataSource in a variable inside the “created” event and when you want to reset the grid, you can reassign this stored value to “grid.dataSource” property. This is suggested as a workaround only.
|
const reset = () => { grid.dataSource = JSON.parse(JSON.stringify(storedData)); }; const created = () => { storedData = JSON.parse(JSON.stringify(grid.dataSource)); };
|
API : https://ej2.syncfusion.com/react/documentation/api/grid/#created
Regards,
Pavithra S