ReferenceManyField 的 React-Admin 列表属性 IsRowExpandable
如果 ReferenceManyField 不存在任何条目,我喜欢将 IsRowExpandable 属性设置为 false。我如何访问 ReferenceManyField 计数或行?我发现了一个类似的问题,但我不知道如何在这种情况下访问这个总道具。 (获取 ReferenceManyField 计数?)
https://marmelab.com/react-admin/List.html#isrowexpandable
const ExpandCardWithDatagrid = () => {
const classes = useStyles();
return (
<Card className={classes.subcard} variant="outlined">
<CardContent>
<ReferenceManyField reference="comments" target="postId">
<Datagrid rowClick="edit">
<NumberField source="myField1" />
<NumberField source="myField2" />
...
</Datagrid>
</ReferenceManyField>
</CardContent>
<CardActions>
<ViewFilteredContractTypesList />
</CardActions>
</Card>
)
}
...
<List
{...props}
bulkActionButtons={false}/>}
>
<Datagrid
rowClick="edit"
isRowExpandable={??????????}
expand={<ExpandCardWithDatagrid />}>
...
I like to set the IsRowExpandable property to false, if no entries for the ReferenceManyField exists. How can i access the ReferenceManyField count or rows? I found a similar question, but i have no idea how can i access this total prop in this context. (Get ReferenceManyField Count?)
https://marmelab.com/react-admin/List.html#isrowexpandable
const ExpandCardWithDatagrid = () => {
const classes = useStyles();
return (
<Card className={classes.subcard} variant="outlined">
<CardContent>
<ReferenceManyField reference="comments" target="postId">
<Datagrid rowClick="edit">
<NumberField source="myField1" />
<NumberField source="myField2" />
...
</Datagrid>
</ReferenceManyField>
</CardContent>
<CardActions>
<ViewFilteredContractTypesList />
</CardActions>
</Card>
)
}
...
<List
{...props}
bulkActionButtons={false}/>}
>
<Datagrid
rowClick="edit"
isRowExpandable={??????????}
expand={<ExpandCardWithDatagrid />}>
...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过创建自己的数据网格并访问其列表上下文来访问总数:
尽管如此,如果没有记录,我不知道这有什么用,但至少是一个关于如何访问列表的简单示例其子级中的上下文属性如
total
You could have access to the total by making your own Datagrid and accessing its list context:
Even though, if there are no records, I don't know how this is useful, but at least is a simple example on how to access a List context props like
total
within its children