Switch between editable and non editable mode in ag-grid

Mohamed Amine Ouali picture Mohamed Amine Ouali · Jul 27, 2017 · Viewed 11.4k times · Source

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?

Answer

Sean Landsman picture Sean Landsman · Jul 27, 2017

editable can be either a boolean as you have it, or a function

If you use the function form you can determine on a cell by cell basis if you want the given cell to be editable

editable: function(params) {
   return true; // true/false based on params (or some other criteria) value
}