Posted 8 July 2021, 4:22 am EST
Hi Tarun,
This is expected behavior from SJS. Actually, by default, all the cells are marked locked so putting the protection will lock the whole sheet. You may use the locked method and lock/unlock range according to your need. Please refer to the following code snippet and attached sample that demonstrates the same.
sheet.suspendPaint();
sheet.setArray(0, 0, [
["", "A", "B", "C", "D"],
["E", 1, 2, 3, 4],
["G", 3, 8, 13, 18],
["H", 5, 9, 13, 17]
]);
sheet.options.isProtected = true;
//by default all cell marked as locked
//if want to change use locked method
//mark all column as unlocked
sheet.getRange(-1, 0, -1, sheet.getColumnCount()).locked(false);
//mark 2nd Column as locked
sheet.getRange(-1, 1, -1, 1).locked(true).backColor("lightgreen");
sheet.resumePaint();
sample: https://codesandbox.io/s/spread-js-starter-forked-fefgw?file=/src/index.js:414-907
protectionDemo: https://www.grapecity.com/spreadjs/demos/features/worksheet/protection#demo_source_name
Regards
Avinash