SpreadJS Documentation > Sample Code > Sample Code for Frequently Used Events > Using Click Events |
You can use code in CellClick and CellDoubleClick events.
This example uses code in the CellClick and CellDoubleClick events.
JavaScript |
Copy Code
|
---|---|
var spread = new GcSpread.Sheets.Spread($("#ss").get(0),{sheetCount:3}); var activeSheet = spread.getActiveSheet(); activeSheet.bind(GcSpread.Sheets.Events.CellClick, function (sender, args) { if(args.sheetArea === GcSpread.Sheets.SheetArea.colHeader){ console.log("The column header was clicked."); } if(args.sheetArea === GcSpread.Sheets.SheetArea.rowHeader){ console.log("The row header was clicked."); } if(args.sheetArea === GcSpread.Sheets.SheetArea.corner){ console.log("The corner header was clicked."); } console.log("Clicked column index: " + args.col); console.log("Clicked row index: " + args.row); }); activeSheet.bind(GcSpread.Sheets.Events.CellDoubleClick, function (sender, args) { if(args.sheetArea === GcSpread.Sheets.SheetArea.colHeader){ console.log("The column header was double clicked."); } if(args.sheetArea === GcSpread.Sheets.SheetArea.rowHeader){ console.log("The row header was double clicked."); } if(args.sheetArea === GcSpread.Sheets.SheetArea.corner){ console.log("The corner header was double clicked."); } console.log("Double clicked column index: " + args.col); console.log("Double clicked row index: " + args.row); }); |