Posted 28 April 2020, 1:37 am EST
Hi I have a combobox cell in spreadhseet. I need to prevent users from copy pasting into this cell because paste will remove the dropdown. Is it possible to prevent paste on a cell?
Forums Home / Spread / SpreadJS
Posted by: datta on 28 April 2020, 1:37 am EST
Posted 28 April 2020, 1:37 am EST
Hi I have a combobox cell in spreadhseet. I need to prevent users from copy pasting into this cell because paste will remove the dropdown. Is it possible to prevent paste on a cell?
Posted 29 April 2020, 9:37 am EST
Hi,
You may use Clipboard Pasting Event for achieving this functionality, while pasting you just need to check whether the pasting range has any comboBox and if it has the Combobox then cancel the operation. Please refer to the following code snippet and sample which demonstrates the same
spread.bind(GC.Spread.Sheets.Events.ClipboardPasting, (e, args) => {
if (hasComboCellType(args.sheet, args.cellRange)) {
args.cancel = true;
return;
}
});
sample:https://codesandbox.io/s/spread-js-starter-k4cri?file=/src/index.js
For more information about the ClipboardPasting Event please refer to the following Docs:
https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.Events~ClipboardPasting_EV.html?highlight=events%2C
Regards