Refresh aggregate values in inline editing Functional Component

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.


6 Replies 1 reply marked as answer

PS Pavithra Subramaniyam Syncfusion Team September 28, 2022 11:29 AM UTC

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



SV Srivathsan V September 28, 2022 01:30 PM UTC

Hi Team,

Thanks for your help. It is working fine.


Regards,

Srivathsan V



SV Srivathsan V September 29, 2022 05:19 AM UTC

Hi Team, 

            Is there any way to get the whole data of the table after user updates the table

Regards,

Srivathsan V



PS Pavithra Subramaniyam Syncfusion Team September 29, 2022 07:18 AM UTC

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



SV Srivathsan V September 29, 2022 10:11 AM UTC

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?



PS Pavithra Subramaniyam Syncfusion Team September 30, 2022 08:45 AM UTC

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


Marked as answer
Loader.
Up arrow icon