Pasting into readOnly columns

Posted by: moritz.neugebauer on 18 November 2020, 9:33 pm EST

    • Post Options:
    • Link

    Posted 18 November 2020, 9:33 pm EST

    Dear Wijmo Team,

    I came up with an issue regarding pasting values into cells of readOnly columns.

    This is my setting:

    • In my grid there is a mix of readOnly and editable columns
    • When adding a new row, the readOnly columns become editable (using the selectionChanging Event)
    • After saving that row, all those columns become readOnly again

    This setting is working fine when adding values into a new row except pasting:

    • Editing a single cell of a readOnly column in the new row by typing works fine
    • Pasting a value into a single cell of a readOnly column in the new row also works fine

    The problem occurs when I copy multiple values (let’s say all cells of an existing row) into a new row. All cells of readOnly columns (that are made editable using the selectionChanging Event) in the new row stay empty. For all the other cells in that row it’s working

    It seems that the pastingCell handler isn’t triggered in that case for those cells.

    
    flexdata.pastingCell.addHandler((s: wjcGrid.FlexGrid, e: wjcGrid.CellRangeEventArgs) => {
                console.log("e: ", e);
    });
    
    

    How can I fix this?

    Best regards

    Moritz

  • Posted 19 November 2020, 4:07 pm EST

    Hi Moritz,

    Since these columns are set to read-only, pasting will not work on these cells. We will need to set the read-only to false before pasting the into the new row by handling the pasting event of FlexGrid. Please refer to the sample link below for reference:

    https://stackblitz.com/edit/angular-3haqxv

    Regards,

    Ashwin

  • Posted 22 November 2020, 7:51 pm EST

    Dear Ashwin,

    thank you for your response. I found the bug on my site of the code.

    I’m already using the selectionChanging event to calculate isReadOnly for cells. For new rows I was calculating isReadOnly only for the selected cell. I switch that to calculating readOnly for every cell of the row when selecting a new row. Now it is working :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