Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch between editable and non editable mode in ag-grid

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?

like image 624
Mohamed Amine Ouali Avatar asked Jul 27 '17 11:07

Mohamed Amine Ouali


2 Answers

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
}
like image 66
Sean Landsman Avatar answered Oct 25 '22 03:10

Sean Landsman


you can set editable property by your way just create another function isEditable(columnName) which will give you boolean result.

this.defaultDefs = {           
    suppressMovable: true,     
    enableColResize: true,     
    editable: isEditable(column),            
};  
like image 28
Nirav Bhadradiya Avatar answered Oct 25 '22 02:10

Nirav Bhadradiya