[]
        
(Showing Draft Content)

Get Dirty Status

SpreadJS sets a cell as "dirty" when the cells are changed and hence needs recalculating as a consequence. If a cell is dirty, the current row is also dirty. You can get the dirty status for cells and rows.


The cell is not dirty when loading bound data. Changing a cell after it is bound to a data source sets the dirty status.


A row is treated as an inserted row instead of a dirty row if a value is set when inserting a row. The dirty status is cleared after setting the row or column count, or when using fromJSON and toJSON methods.


You can clear the dirty status with the clearPendingChanges method. You can get dirty rows and cells with the getDirtyRows and getDirtyCells methods.


The following code sample shows how to edit a cell to set the dirty status and use a button to clear the dirty status.

var customers = [
               { ID: 0, Name: 'A', Info1: 'Info0' },
               { ID: 1, Name: 'B', Info1: 'Info1' },
               { ID: 2, Name: 'C', Info1: 'Info2' },
            ];
            activeSheet.setDataSource(customers);
$("#button1").click(function () {
activeSheet.clearPendingChanges();
   });
// Add button control to page
<input type="button" id="button1" value="button1"/>