how to disable editing for only some rows in ag grid

L.E picture L.E · May 10, 2018 · Viewed 8.9k times · Source

i want to enable only some rows in my ag-grid(exemple :2/5) based on a condition .

editable:false can't help because it is applied on the whole list unless if there is a method I do not know

any help please

Answer

un.spike picture un.spike · Sep 12, 2018

You can just bind function to editable property in columnDef, which will be executed on each try of edit

editable: this.checkEditFunction.bind(this)
...
checkEditFunction(params){
    //params.node - for row identity
    //params.column - for column identity
    return !params.node.isRowPinned() // - just as sample
}

.bind(this) - just for accessibility of external functions