SpreadJS Documentation > Developer's Guide > Managing the User Interface > Using Protect and Cell Locking |
You can protect the sheet and lock cells in the widget.
Use the setIsProtected method to protect the sheet and the locked method to lock a cell.
Cells can still be edited if the sheet setIsProtected method is false.
Protecting the sheet prevents cells from being edited. If you wish to allow the user to edit specific cells, protect the sheet and unlock only the cells you want the user to edit.
Data can be copied from locked cells.
The protectionOption method can be used to specify what areas you want the user to be allowed to change. Areas can include resizing rows or columns, filtering, and so on.
This example unlocks a cell.
JavaScript |
Copy Code
|
---|---|
sheet.getCell(1,1).locked(false); sheet.setValue(1,1,"unLocked"); sheet.getColumn(3).locked(false); sheet.getRow(5).locked(false); sheet.setIsProtected(true); |