Get Free Trial

Disallow cell editing conditionally

Akshay Alva asked on August 9, 2021

Is there any way to disallow editing of a cell conditionally when the “editing: true” option is enabled.
For example, we want to disallow :

  1. if the value of the cell is a text field
  2. if the cell is representing a year
  3. if the cell value (measure) belongs to a historic data (for ex: May-2021 data)

Thanks in advance.

3 answers

Vera Didenko Vera Didenko Flexmonster August 10, 2021

Thank you for your question.
Currently, it is only possible to enable/disable editing for all cells at the same time.
Flexmonster is a tool for a visual representation of the existing data; therefore, it doesn’t focus on editing the underlying data set.
Feel free to reach out should other questions arise.
Kind regards,

Akshay Alva August 10, 2021

Hi Vera,
Thanks for your response. An additional question, since calculated total values (row and column totals) are not editable by default, is there a way to color code/highlight these fields so there is a clear differentiation to the user on the editable and non-editable fields in the table?
Warm Regards,

Vera Didenko Vera Didenko Flexmonster August 10, 2021

Hello, Akshay,
Thank you for your reply.
Yes, you can add additional CSS styles to specific cells.

Depending on your use case, there are two approaches:

  1. Adding styles by modifying existing elements via CSS:
    Here is a JSFiddle for illustration:
  2. Adding additional CSS styles via the customizeCell hook:
    Through customizeCell, you can get additional details about each cell in the Cell Data Object.
    This way, you can add a background color to highlight certain cells based on their type, value, position on the grid, etc.

Please let us know if this helps. Also, could you please specify your data source type?
Thank you, and looking forward to your response.

Kind regards,

Please login or Register to Submit Answer