Make cell/row editable if all columns are readOnly

Posted by: moritz.neugebauer on 15 September 2020, 10:50 pm EST

  • Posted 15 September 2020, 10:50 pm EST

    Dear Wijmo Team,

    I need to make all cells of a row editable, even though all columns of the grid are readOnly.

    The solution of this thread doesn't work out for me, because the beginningEdit event isn't fired when I click on a cell of a column that is readOnly.
    https://www.grapecity.com/forums/wijmo/flexgrid-how-to-make-a-par

    I already achieved to change the appearance of a single row to look like it is editable when all columns are set to be readOnly but I was not able to make the cells editable.

    flexdata.formatItem.addHandler((s: wjcGrid.FlexGrid, e: wjcGrid.FormatItemEventArgs) => {
    ...

    if(item.isEinzelwertbearbeiter) {
    let classes = e.cell.classList;
    classes.remove(disabledCell);
    }

    ...
    }


    How can I achieve that?

    Best regards
    Moritz
  • Replied 16 September 2020, 4:22 pm EST

    Hi Moritz,

    If the whole column is read-only, then all the rows in that column will not be editable. To fulfill your requirements, you can handle the selectionChanging event of the FlexGrid and set the current column as editable according to the row. Please refer to the sample link below for reference:

    https://stackblitz.com/edit/angular-d27kah

    Regards,
    Ashwin
  • Replied 21 September 2020, 5:40 pm EST

    Dear Ashwin,

    thank you for your answer. Using the onSelectionChanging method works well for me. Is there a way to detect if the row is a new row? I would like to change the readOnly property for a row that is added to the grid.

    My requirement is basically like this:
    * Make certain cells of a new row editabled
    * After the row is saved to the grid, make it readOnly.

    Best regrads
    Moritz
  • Replied 22 September 2020, 8:41 pm EST

    Hi Moritz,

    You use the index property of the row to check whether it is a template of new row or an actual data row. Please refer to the updated sample link below for reference:

    https://stackblitz.com/edit/angular-v159f4

    ~regards
Need extra support?

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

Learn More

Forum Channels