Devextreme-reactive: Allow editing of specific columns

Created on 30 Dec 2017  路  5Comments  路  Source: DevExpress/devextreme-reactive

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 :)

Your Environment

devextreme-reactive material-ui beta.3

Grid

Most helpful comment

Hi,

Yes, it's on our short list.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SferaDev picture SferaDev  路  3Comments

rajmakda picture rajmakda  路  3Comments

madebymt picture madebymt  路  3Comments

zcuric picture zcuric  路  3Comments

sintuchintu picture sintuchintu  路  3Comments