I have a ReferenceField as follows:
<ReferenceField label="User" source="user_id" reference="users">
<TextField source="name" />
</ReferenceField>
It works nice but the problem is sometimes user_id might be null and that causes the loading bar to be displayed indefinetely. Is there any way that if the value of the reference field is null to display an alternative text or similar?
No, there is no alternative text or something as an option.
Your id being null, should just leave the ReferenceField empty, not displaying loading bar.
Changing your ReferenceField element by adding "allowEmpty" and it should work:
<ReferenceField label="User" source="user_id" reference="users" allowEmpty>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With