Flexsheet:stop ctrl+v ctrl+c to read-only cells

Posted by: sasmita.swain2014 on 28 August 2018, 6:09 pm EST

    • Post Options:
    • Link

    Posted 28 August 2018, 6:09 pm EST

    Hi,

    We are using flexsheet with angular. We are making some cells read-only on some conditions in beginningEdit even. But the read-only cell changes to editable on ctrl+v.

    Please provide a solution to stop the copy-paste to read-only cells.

    Thanks,

    Sasmita

  • Posted 29 August 2018, 3:25 pm EST

    Hi Sasmita,

    To disable pasting in read-only cells all you have to do is handle the pastingCell event, in the event handler check if the cell being pasted is read-only and if it is read-only then cancel the event.

    Please refer to the following code snippet:-

    flexSheet.pastingCell.addHandler((s, e) => {
    	if( isReadOnlyCell( flexSheet, e.row, e.col ) ){
    		//cell is read-only, cancel the event
    		e.cancel = true;
    	}
    });
    

    You may also refer to the following sample for full implementation:-

    https://stackblitz.com/edit/angular-ubmt8d?file=app%2Fapp.component.ts

    ~Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels