简体   繁体   English

react-admin:如何在Datagrid的每一行上显示Delete按钮

[英]react-admin: How to show Delete button on each row in Datagrid

I would like to have Datagrid with Delete button as below (picture is copied from stackoverflow.com): 我想使用带有Delete按钮的Datagrid,如下所示(图片是从stackoverflow.com复制的):

带删除按钮的Datagrid

I read react-admin documents but did not find any hints to add a Delete button onto the row. 我阅读了react-admin文档,但没有发现任何将Delete按钮添加到该行的提示。 Any body know how to? 有谁知道怎么做?

Thanks, 谢谢,

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>
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM