How does multiselection and canceling pasting work?

Posted by: moritz.neugebauer on 5 October 2020, 4:09 am EST

    • Post Options:
    • Link

    Posted 5 October 2020, 4:09 am EST

    Dear Wijmo team,

    I’m using Pasting-Handler to check, whether the user is allowed to paste values into cells of a row.

    It works fine, when I want to paste into a single selected cell.

    
    let row = s.rows[e.row];
    if(row.dataItem.isReadOnly) {
        e.cancel = true;    
    }
    
    

    If that cell is in a row that is readOnly, pasting is cancled.

    But when I select cells from different rows and one single row is not readOnly, then the value gets pasted into every cell that is selected.

    How can I apply the check to every cell that is selected?

    Best regards

    Moritz

  • Posted 6 October 2020, 12:38 am EST

    Hi Mortiz,

    The pasting event runs only for the first cell which is selected. That is why, even if some rows are read-only, the data is still pasted on the grid. Instead of this event, I will suggest you use the pastingCell event of the FlexGrid. This event runs for each of the cells on which pasting is being done. You can check whether the row of the current cell is read-only and cancel the event accordingly.

    https://www.grapecity.com/wijmo/api/classes/wijmo_grid.flexgrid.html#pastingcell

    Regards,

    Ashwin

  • Posted 12 October 2020, 3:02 am EST

    Hi Ashwin,

    thank you very much for your response. After adapting the pastingCell and also the pastedCell Event, it now works as expected. Thank you :slight_smile:

    Best regards

    Moritz

Need extra support?

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

Learn More

Forum Channels