marmelab / aor-dependent-input

A component for displaying input depending on other inputs values in Admin-on-rest
MIT License
60 stars 12 forks source link

DependentInput does not work #26

Closed mgomezcuesta closed 5 years ago

mgomezcuesta commented 5 years ago

Hi.

Option 1:

import {DependentInput} from 'aor-dependent-input';
<TextField source="type" />
<DependentInput dependsOn="type" value="NATURAL" >
    <TextField source="firstName" />
    <TextField source="lastName" />
</DependentInput>            
<DependentInput dependsOn="type" value="JURIDICAL" >
    <TextField source="companyName" label="Company name"/>
</DependentInput>

Option 2:

import {DependentInput} from 'aor-dependent-input';
const isNatural = (record) => record.isNatural;
<TextField source="type" />
<DependentInput resolve={isNatural} >
    <TextField source="firstName" />
    <TextField source="lastName" />
</DependentInput>

Option 3:

const isNaturalUser = (value) => {value.startsWith('NATURAL');}
<TextField source="type" />
<DependentInput dependsOn="type" resolve={isNaturalUser} >
    <TextField source="firstName" />
    <TextField source="lastName" />
</DependentInput>

image

Used Versions: "admin-on-rest": "^1.4.1", "aor-dependent-input": "^1.2.0",

Could anyone help me?

Thanks you very much.

djhi commented 5 years ago

If you are able to illustrate the bug or feature request with an example, please provide a sample application via one of the following means:

fzaninotto commented 5 years ago

Note that aor-dependent-input is deprecated. In react-admin (successor to admin-on-rest), dependent inputs are implemented with the FormDataConsumer component.

mgomezcuesta commented 5 years ago

Thanks so much. I have to check with FormDataConsumer component.