SpreadJS 13
GC.Spread.Sheets.CellTypes Namespace / Button class / Button Constructor
In This Topic
    Button Constructor
    In This Topic
    Represents a button cell.
    Syntax
    var instance = new GC.Spread.Sheets.CellTypes.Button();
    function Button() : Button;
    Example
    This example creates a button cell.
    var cellType = new GC.Spread.Sheets.CellTypes.Button(); 
    cellType.buttonBackColor("#FFFF00"); 
    cellType.text("this is a button"); 
    activeSheet.setCellType(1,1,cellType);
    
    spread.bind(GC.Spread.Sheets.Events.ButtonClicked, function (e, args) {
        var sheet = args.sheet, row = args.row, col = args.col;
        var cellType = activeSheet.getCellType(row, col);
        if (cellType instanceof GC.Spread.Sheets.CellTypes.Button) {
            alert("Button Clicked");
        }
    });
    See Also

    Reference

    Button class