react-admin - 为什么我会收到“关联的参考资料似乎不再可用”?
问题描述
我在这里解释了整个问题https://github.com/marmelab/react-admin/issues/5142。但就 stackoverflow 社区更活跃而言,我在这里也提到了这个问题。
请解释一下,为什么这个示例代码可以正常工作
<ReferenceInput label={"Specification"} perPage={20} source={"specificationName"}
reference={ResourceNames.SPECIFICATIONS}>
<SelectInput optionText={"name"}/>
</ReferenceInput>
虽然此代码显示"Associated reference no longer appears to be available"
错误消息。
<ReferenceInput label={"Specification"} perPage={20} source={"specificationName"}
reference={ResourceNames.SPECIFICATIONS}>
<SelectInput optionText={"name"} optionValue={"name"} />
</ReferenceInput>
上述示例之间的唯一区别是optionValue
传递给SelectInput
. 它出什么问题了?我不希望 mySelectInput
用作ID
值...该optionValue
属性与上述错误消息有何关系?
请帮忙!先感谢您
解决方案
我找到了解决方案。React-Admin 需要id
用于资源识别。
但是,如果您需要为您的资源自定义标识符,请查看下面的文章
请参阅https://marmelab.com/react-admin/FAQ.html#can-i-have-custom-identifiersprimary-keys-for-my-resources
推荐阅读
- javascript - 比较对象内的键值以进行重复更新
- postgresql - 如何以不同的用户(我自己)而不是 postgres 用户身份启动 postgres 服务
- python - 如何获取从副本创建的新文件夹/工作表的 ID?
- javascript - 我的代码中的未知循环/计数器
- ruby - 使用 Ruby/Watir 检查复选框
- python - 如何在 Pandas 中对带有数字的字符串进行排序?
- amazon-web-services - 通过查询用户定义的标签列出唯一的 EC2 卷快照
- python - Tensorflow,在多处理中更新权重
- java - 写入 Azure 的 Log Analytics 数据收集器 API 返回 403。昨天工作正常
- javascript - 将文件对象保存到文件中 - sweetalert2 - javascript - php