SpreadJS Documentation
Getting the Dirty Status
SpreadJS Documentation > Developer's Guide > Managing Data > Getting the Dirty Status

You can get the dirty status for cells and rows.

Changing a cell causes the dirty status to be set. If a cell is dirty, the current row is also dirty.

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.

Using Code

Edit a cell to set the dirty status. Select the button to clear the dirty status.

JavaScript
Copy Code

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"/>

See Also