Search code examples
admin-on-rest

Use ReferenceInput, it shows blank


When I use ReferenceInput, it shows blank with no error in the chrome console.

Below is my code. Your help, thanks.

in App.js

<Admin >
    <Resource name="ps" list={ConnectList} create={ConnectCreate} />
    <Resource name="schema" list={SchemaList} />
</Admin >

in ps.js

export const ConnectCreate = (props) => (
<Create title="Create New Connect Task Guide" {...props}>
    <TabbedForm>
        <FormTab label="Overview">
            <ReferenceInput label="browse topics" source="id" reference="schema" >
                   <SelectInput optionText="subject" />
            </ReferenceInput>
        </FormTab>
    </TabbedForm>        
    </Create>
);   

schema json is as follows. I can see it successfully returned from browser network. However, the UI shows nothing.

[{"id":"1", "subject":"test_value"},{"id":"2", "subject":"test_value2"}]

Solution

  • added allowEmpty, it works. Thanks guys anyway.