Get cell value from row

Hello,

How do I get the value of a given cell on the worksheet?

For example, the first column is the database ID. When I edit some cell I would like to get the value of this corresponding ID from the same row.

I am using EJ2.

Thanks


3 Replies

SP Sangeetha Priya Murugan Syncfusion Team August 12, 2022 08:30 AM UTC

Hi Fernando,


We have checked your requirement and the dataSourceChanged event handler will be triggered when editing, inserting and deleting a row is made on the datasource range. It is triggered with parameter named action which indicates edit, add and delete for the respective action. By using this event you can get the modified row data.


 

  dataSourceChanged (args) {

    //args.data returns the modified data in spreadsheet

    switch (args.action) {

      case 'edit':

        console.log('Edited Data: ' + JSON.stringify(args.data));

        //Do your customization for edit action

        break;

      case 'add':

        console.log('Added Data: ' + JSON.stringify(args.data));

        // Do your customization for insert action

        break;

      case 'delete':

        console.log('Deleted Data: ' + JSON.stringify(args.data));

        // Do your customization edit action

        break;

    }

  }


API Link: https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet#datasourcechanged


Could you please check the above links and get back to us, if you need any further assistance on this.


Regards,

Sangeetha M



FE Fernando August 12, 2022 12:36 PM UTC

Hi, it worked perfectly. Thank you so much.



SP Sangeetha Priya Murugan Syncfusion Team August 15, 2022 06:26 AM UTC

Hi Fernando,


We are happy to hear that your issue has been resolved. Kindly get back to us if you need any further assistance.


Regards,

Sangeetha M



Loader.
Up arrow icon