It is possible to input the same input, but with two different values using Ant.design?

Asked

Viewed 34 times

1

I am using React + Ant.design and I need to create a table where each line receives the same input, however it must have different values, the way I am doing the second value replaces the first.

inserir a descrição da imagem aqui

I need both values to be saved, but you’re only saving the last one.

My Table:

<Table dataSource={questions} pagination={false} size="middle">
          <Column
            title="Remuneração"
            width="50%"
            dataIndex="selectOption"
            key="selectOption"
          />

          <Column
            title="Desejado"
            className="text-center"
            render={this.renderInput()}
          />

          <Column
            title="Oferecido"
            className="text-center"
            render={this.renderInput()}
          />
        </Table>

Renderinput:

renderInput = id => (text, record) => (
    <Input
      name={record.key}
      onChange={this.onInputChange}
    />
  );

onInputChange:

onInputChange = ({ target: { name, value } }) =>
    this.props.onChange({ ...this.props.value, [name]: value });

Upshot:

inserir a descrição da imagem aqui

I need the result to be something like this:

direct salary: "first value", "Second value"

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.