react-admin:如何在 Datagrid 的每一行上显示删除按钮 [英] react-admin: How to show Delete button on each row in Datagrid

查看:67
本文介绍了react-admin:如何在 Datagrid 的每一行上显示删除按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要带有 Delete 按钮的 Datagrid 如下(图片是从 stackoverflow.com 复制的):

I would like to have Datagrid with Delete button as below (picture is copied from stackoverflow.com):

我阅读了 react-admin 文档,但没有找到将 Delete 按钮添加到该行的任何提示.有人知道怎么做吗?

I read react-admin documents but did not find any hints to add a Delete button onto the row. Any body know how to?

谢谢,

推荐答案

就像导入并添加到列表视图一样简单:

It is as simple as importing and adding the to your listview:

import { Datagrid, TextField, EditButton, DeleteButton } from 'react-admin';
export const SaleList = props => (
    <List {...props}>
        <Datagrid>
            <TextField source="id"/>
            <EditButton/>
            <DeleteButton/>
        </Datagrid>
    </List>
);

这篇关于react-admin:如何在 Datagrid 的每一行上显示删除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆