Search code examples
admin-on-rest

ReferenceInput and DependentInput


I have 2 ReferenceInput. The thing I want is to pick a company and show only branches of that company. I try this but it does not work. The branches have a field called motherID that connects them with the companies.

<ReferenceInput  source="CompanyID" reference="companies" allowEmpty alwaysOn>
<SelectInput optionText={choice => `${choice.name}`} />
</ReferenceInput>

<DependentInput dependsOn="CompanyID" >
<ReferenceInput  source="BranchID" reference="branches" allowEmpty alwaysOn>
<SelectInput optionText={choice => `${choice.tmima  +" "+ choice.address}`} />
</ReferenceInput>
</DependentInput>

Solution

  • I think this is the same scenario as in the README: https://github.com/marmelab/aor-dependent-input#re-rendering-the-dependentinput-children-when-the-values-of-the-dependencies-change

    Can you try and let us know how it goes ?