Hello,
I would like to know if there is a way to only allow editing of specific columns.
For example, let say I have 4 columns:
Id, Firstname, Lastname, Email
And I would like to only allow editing of Firstname and Lastname and leave others intact
If it's not possible, i'm sure it can be a great improvement :)
devextreme-reactive material-ui beta.3
Hello
You could do something like this:
import Input from 'material-ui/Input';
editCellComponent = (props) => {
const { onValueChange, ...other } = props;
if (props.column.name === 'id' || props.column.name === 'email') {
return(
<Table.Cell {...other}>
<Input
disabled
value={other.value || ''}/>
</Table.Cell>
);
}
return (
<Table.Cell {...other} >
<Input onChange={e => onValueChange(e.target.value)} value={other.value || ''} />
</Table.Cell>
);
};
md5-73da687c427a663a1b24cfede28a725c
editCellComponent = (props) => {
const { onValueChange, ...other } = props;
if (props.column.name === 'firstname' || props.column.name === 'lastname') {
return(
<Table.Cell {...other}>
<Input
onChange={e => onValueChange(e.target.value)}
value={other.value || ''}/>
</Table.Cell>
);
}
return (
<Table.Cell {...other} />
);
};
md5-b77b775b7bb7387855ba2d7b84c5c966
<TableEditRow cellComponent={this.editCellComponent} />
Thats if you are using Material-UI.
Thank you it's perfect :)
Thanks for this info, it was helpful. Given this is a beta, are there plans to implement an allowEdit on the column definition down the line?
Hi,
聽
Yes, it's on our short list.
This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests.
Most helpful comment
Hi,
聽
Yes, it's on our short list.