Search code examples
admin-on-rest

ReferenceInput and SelectInput first option


I have a filter that has a SelectInput inside a ReferenceInput and it has only one option. I really need that first option to be selected.

<ReferenceInput  source="BranchID" reference="branches" allowEmpty alwaysOn  perPage={1000}>
    <SelectInput optionText={choice => `${choice.number  +" "+ choice.address}`} />
    </ReferenceInput>

Solution

  • You can achieve that using default values on your form: https://marmelab.com/admin-on-rest/CreateEdit.html#default-values