SpreadJS Documentation
Locking Cells

You can lock cells.

Using Code

This example locks cells and protects the sheet.

JavaScript
Copy Code
$(document).ready(function () {
    var spread = new GcSpread.Sheets.Spread($("#ss").get(0),{sheetCount:3});
    var activeSheet = spread.getActiveSheet();
  
    //unlock the entire column 1.
    activeSheet.getColumn(2, GcSpread.Sheets.SheetArea.viewport).locked(false);

    //unlock cell(1,3).
    activeSheet.getCell(1, 3, GcSpread.Sheets.SheetArea.viewport).locked(false);
    activeSheet.getCell(1, 3, GcSpread.Sheets.SheetArea.viewport).value("unlocked");

    //Protect the sheet, then cells can edit only when they are unlocked.
    activeSheet.setIsProtected(true);
});
See Also

Developer's Guide

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.