我用rc-table生成表。 这是表的结构:
const columns = [
{
title: 'ID', dataIndex: '_id', key:'_id', width: 100,
}, {
title: 'ISBN', dataIndex: 'isbn', key:'isbn', width: 100,
}, {
title: 'CAPTION', dataIndex: 'caption', key:'caption', width: 100,
}, {
title: 'AUTHOR', dataIndex: 'author', key:'author', width: 100
}, {
title:' V', dataIndex:'__v', key:'__v', width: 100
}];
这是要填充到表中的数据:
var data = //json from server
此行生成并查看一个表:
ReactDOM.render(<Table columns={columns} data={data}/>, document.getElementById('table'));
我需要向已经生成的表中添加新行。如果我尝试将具有新数据的表呈现到相同的div
,它将删除先前的表并添加具有新数据的新表。前几行不保存。但是我需要在同一张表中添加新行并保存以前的行...更新表。我该怎么做?谢谢。