Posted 19 September 2023, 1:10 am EST
Hi,
I have multiple sheets , I have custom button on click of which I want to have only those rows which are changed.
Can you help me solution for this?
Regards,
Priya B
Forums Home / Spread / SpreadJS
Posted by: priyatama.bhadke on 19 September 2023, 1:10 am EST
Posted 19 September 2023, 1:10 am EST
Hi,
I have multiple sheets , I have custom button on click of which I want to have only those rows which are changed.
Can you help me solution for this?
Regards,
Priya B
Posted 19 September 2023, 4:54 pm EST - Updated 19 September 2023, 4:59 pm EST
Hi Priya,
To get the dirty rows, you could use the getDirtyRows() method of the worksheet and to get the dirty cells, you could use he getDirtyCells() method of the worksheet.
// Get the Dirty Rows
console.log(sheet.getDirtyRows());
// Get the Dirty Cells
console.log(sheet.getDirtyCells());
You may also refer to the following demo on Dirty Items: https://www.grapecity.com/spreadjs/demos/features/cells/edit/dirty-items#demo_source_name
In the sample, for the getDirtyRows() method, you will get the originalItem and item as null, because in the sample, we have not used the “sheet binding”. If you have used the sheet binding, it would give the originalItems and item property. You may refer to the following demo on Sheet Binding: https://www.grapecity.com/spreadjs/demos/features/data-binding/sheet-level-binding/purejs
References:
getDirtyRows method: https://www.grapecity.com/spreadjs/api/v15/classes/GC.Spread.Sheets.Worksheet#getdirtyrows
getDirtyCells method: https://www.grapecity.com/spreadjs/api/v15/classes/GC.Spread.Sheets.Worksheet#getdirtycells
Regards,
Ankit