Skip to content

AG Grid: Conditional Editing #4227

Closed Answered by falkoschindler
sbixl asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @sbixl,

You won't be able to pass Python functions to AG Grid. But we can define the required behavior in JavaScript depending on params and pass it like this:

ui.aggrid({
    "columnDefs": [
        {"headerName": "Name", "field": "name", "type": "editableColumn"},
        {"headerName": "Age", "field": "age", "type": "editableColumn"},
    ],
    "rowData": [
        {"name": "Alice", "age": 18},
        {"name": "Bob", "age": 21},
        {"name": "Carol", "age": 42},
    ],
    "columnTypes": {"editableColumn": {":editable": "(params) => params.data.name != 'Alice'"}},
})

In this case a cell is editable as long as the name of this row isn't "Alice".

Note the leading colon :. It ind…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by sbixl
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants