Switch between editable and non editable mode in ag-grid

Viewed 15505

I am using ag-grid to display and modify data.How Can I switch between editable and non editable for the hole ag-grid. Can I do this with the grid api.

this is my default config:

this.defaultDefs = {           
    suppressMovable: true,     
    enableColResize: true,     
    editable: true,            
};     

Can I change editable dynamically?

5 Answers

Do a logic check in the cellEditingStarted callback, calling the stop() when the check fails. You may need to write some css to style it or add a toast/notification to give the user feedback on why they're not able to edit.

You can use it like this:

  1. editable: (params) => your logic
  2. update your date
  3. call api.redrawRows({ rowNodes: [node] })
Related