SpreadJS Documentation > Sample Code > Sample Code for Cells > Using the Button Clicked Event with Cells |
You can use the ButtonClicked event with button, check box, or hyperlink cells.
The ButtonClicked event occurs when the user clicks a button, check box, or hyperlink in a cell.
This example displays a message when you click on the button cell.
JavaScript |
Copy Code
|
---|---|
var cellType = new GcSpread.Sheets.ButtonCellType(); cellType.buttonBackColor("#FFFF00"); cellType.text("this is a button"); activeSheet.setCellType(1,1,cellType); spread.bind(GcSpread.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 GcSpread.Sheets.ButtonCellType) { alert("Button Clicked"); } }); |