myroslav
myroslav

Reputation: 1798

How to change value in ag-grid when user enters the cell?

I have an ag-grid grid with a regular(string) column. When the user enters the cell for editing, I need to change the way the cell value is presented. For example, the column shows "15-Jan-2018" in non-edit mode, but when the user clicks to edit this cell, the text editor that appears should have "2018-01-15" diplayed in it.

Upvotes: 0

Views: 1517

Answers (1)

Senal
Senal

Reputation: 1620

On your column definition of this date column you can specify a cellEditor or cellEditorFramework. Difference between these two is if you use cellEditor you have to register the components and if you use cellEditorFramework you can directly refer to the component class.

{
    headerName: "Date",
    field: "date",
    editable: true,
    cellEditor: 'DateEditorComponent'
}

or

{
    headerName: "Date",
    field: "date",
    editable: true,
    cellEditorFramework: DateEditorComponent
}

You can find the documentation about this here and an angular example is here.

Upvotes: 2

Related Questions