How to only accept number in Aggrid Cell Editor

Hi Dash Community:

In this example:

You can see, If one enters a string ( type dagaxfdsa ) in the number cell, it doesn’t take this input, but only can accept number.

In Dash, if I enter the random string in the cell specified with below, it can actually still takes the string. I understand that one can use the example here: Cell Editors | Dash for Python Documentation | Plotly to predicts strings. However, is there a way to get the default behavior in Ag Grid for Dash for this example? Thanks.

columnDefs: [
{
cellEditor: ‘agNumberCellEditor’,
cellEditorParams: {
min: 1,
max: 100,
precision: 0,
}
// …other props
}
]

Hello @entropy_l,

This should be the default for number columns.

Can you give an MRE? Also, what version of Dash AG Grid are you running?

@entropy_l

The built-in cell editors for number, date and a boolean cell data types is new in AG Grid 30.

The current dash-ag-grid is v2.3.0 which uses AG Grid 29.3.5. You can find the docs for the upstream AG Grid 29.3.5 by using a URL like this:

https://www.ag-grid.com/archive/29.3.5/react-data-grid/

Hopefully the next version of the dash-ag-grid will be released soon. In the meantime you can use a custom number input component as shown in the dash docs here:

Thank you for confirming this!

I could not get this to work - still happily accepts anything:

{
    "headerName": "RM",
    "field": "RM",
    'editable': True,
    "cellEditor": "agNumberCellEditor",
    "type": "numericColumn",
    "valueFormatter": {"function": "d3.format('.1f')(params.value)"},
    "filter": "agNumberColumnFilter",
    "cellDataType": 'number'

},