SpreadJS Documentation > Sample Code > Sample Code for Cells > Changing the Active Cell Backcolor |
You can change the color of the active cell.
This example changes the color of the active cell.
JavaScript |
Copy Code
|
---|---|
$(document).ready(function () { var spread = new GcSpread.Sheets.Spread($("#ss").get(0),{sheetCount:3}); var sheet = spread.getActiveSheet(); sheet.getCell(0, 0).backColor("pink"); sheet.bind(GcSpread.Sheets.Events.LeaveCell, function (event, infos) { //Reset the backcolor of cell before moving infos.sheet.getCell(infos.row, infos.col).backColor(undefined); }); sheet.bind(GcSpread.Sheets.Events.EnterCell, function (event, infos) { //Set the backcolor of destination cells (currently active cells) infos.sheet.getCell(infos.row, infos.col).backColor("pink"); }); }); |