SpreadJS 13
SpreadJS Documentation / Sample Code / Sample Code for Frequently Used Events / Using Events when Sheet Changes
In This Topic
    Using Events when Sheet Changes
    In This Topic

    You can use code in SheetChanging and SheetChanged events.

    The SheetChanging event is fired before a sheet is changed whereas a SheetChanged event is fired after a sheet is changed. The sheet changes here include inserting, deleting, hiding or unhiding a sheet by using context menu or clicking  the "+" button in sheet tab.

    Using Code

    This example uses the SheetChanged and SheetChanging events.

    JavaScript
    Copy Code
    // initializing Spread
    var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 });
    
    // Bind SheetChanged event
    spread.bind(GC.Spread.Sheets.Events.SheetChanged, function (sender, args) {
        console.log("Changed type: " + args.propertyName + " & Sheet Index : " + args.sheetIndex);
    });
    
    // Bind SheetChanging event
    spread.bind(GC.Spread.Sheets.Events.SheetChanging, function (sender, args) {
        console.log("Changing type: " + args.propertyName + " & Sheet Index : " + args.sheetIndex);