SpreadJS Documentation
GC.Spread.Sheets Namespace / CellTypes type / Button Method
In This Topic
    Button Method
    In This Topic
    Represents a button cell.
    Syntax
    var value; // Type: any
    value = GC.Spread.Sheets.CellTypes.Button();
    function Button() : any;
    Example
    //This example creates a button cell.
    var spread = new GC.Spread.Sheets.Workbook();
    var sheet = spread.getActiveSheet();
    var cellType = new GC.Spread.Sheets.CellTypes.Button();
    cellType.buttonBackColor("#FFFF00");
    cellType.text("this is a button");
    sheet.setCellType(1,1,cellType);
    //Bind event
    spread.bind(GC.Spread.Sheets.Events.ButtonClicked, function (e, args) {
        var sheet = args.sheet, row = args.row, col = args.col;
        var cellType = sheet.getCellType(row, col);
        if (cellType instanceof GC.Spread.Sheets.CellTypes.Button) {
            alert("Button Clicked");
        }
    });
    See Also

    Reference

    CellTypes type