Posted 17 March 2022, 2:26 pm EST
I’m have this code with framework React to locked cells, but not function. What solution to my problem?
const sheet = spread.getActiveSheet();
sheet.getRange(-1, 1, -1, 1).locked(true).backColor('lightgreen');
Forums Home / Spread / SpreadJS
Posted by: grazielleconceicao on 17 March 2022, 2:26 pm EST
Posted 17 March 2022, 2:26 pm EST
I’m have this code with framework React to locked cells, but not function. What solution to my problem?
const sheet = spread.getActiveSheet();
sheet.getRange(-1, 1, -1, 1).locked(true).backColor('lightgreen');
Posted 21 March 2022, 12:50 am EST
Hi Grazielle,
You need to set the isProtected option on sheet to be true, then only locked method will work.
Please refer to the following sample that I have created for you: https://jscodemine.grapecity.com/share/Rcyk7EkumEmT1UyBQOuYEQ/
Protect Worksheet and Locked Cells: https://www.grapecity.com/spreadjs/docs/latest/online/celllock.html
Please let us know if you face any further issues.
Regards
Ankit
Posted 21 March 2022, 8:32 am EST
It worked, I didn’t know I should lock the whole worksheet before.
Thanks!