Прочитайте данные из TextInput в react-admin

У меня есть TextInput(source="values"), и я хочу прочитать оттуда с помощью кнопки и изменить строковое значение с этим значением

Мой пример кода выглядит следующим образом;

class DataTypeCreate extends Component {
    state = {
        values: ''
    }

    addClickedHandler = (x) => {
        let value = this.props.values;
        this.setState((prevValue) => {
            return { values: prevValue.values + ", " + this.values}
        });
        console.log(this.state.values);
    }

    render() {
        return(
            <Create {...this.props}>
                <SimpleForm redirect="list"
                    validate={values => {
                        const errors = {};

                        ["id", "type"].forEach(field => {
                            if (!values[field]) {
                                errors[field] = ["Required field"];
                            }
                        });

                        return errors;
                    }}>
                    <TextInput source="id" label="Name" />
                    <SelectInput
                        source="type"
                        choices={[
                            { name: "String", id: "string" },
                            { name: "Enum", id: "enum" },
                            { name: "Decimal", id: "decimal" }
                        ]}
                    />
                    <TextInput source="values" />
                    <Button clicked={this.addClickedHandler} name="Value"></Button>
                    {/* <ReferenceArrayInput reference="values" source="values" label="Values">
                        <SelectArrayInput>
                            <ChipField source="name" />
                        </SelectArrayInput>
                    </ReferenceArrayInput> */}
                </SimpleForm>
            </Create>
        )
    }
}

export default DataTypeCreate;

Возможно ли это в реакции-админе? Можете вы помочь мне? Спасибо


person Cansel Muti    schedule 18.05.2018    source источник
comment
Какое строковое значение вы хотите изменить? Значение другого входа?   -  person Gildas Garcia    schedule 01.08.2018