Hi,
Is there anyway to use the maxLength input attribute to limit the number of characters that are allowed to a specific field?
Thanks
Ok, so I'e figured out how to do this for all input fields by using:
components={{
EditField: props => (
/>
),
}}
but i'm not sure how to make this work on individual fields
For anyone who looks for it here is how I've achieve it. You will need to import TextField from material-ui
columns: [
{
title: 'Title', field: 'title', editComponent: props => {
return (
<TextField
value={props.value}
inputProps={{ maxLength: 24 }}
/>
)
}
}
]
Wanted to update this thread. @omriran's solution worked for me only after including the onChange handler:
columns: [
{
title: 'Title', field: 'title', editComponent: props => {
return (
<TextField
value={props.value}
inputProps={{ maxLength: 24 }}
onChange={(event) => {props.onChange(event.target.value)}
/>
)
}
}
]
Most helpful comment
For anyone who looks for it here is how I've achieve it. You will need to import TextField from material-ui