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.
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:
I need the result to be something like this:
direct salary: "first value", "Second value"