这是我使用 react-data-grid 的第一个示例表,列不会彼此相邻呈现,而是相互重叠
下面是我正在尝试的非常基本的示例代码。该代码使用数据呈现表格,但将列和数据呈现在彼此之上,如下所示:
输出:
ID 标题 1 任务 2 任务
import React from 'react';
import DataGrid from 'react-data-grid';
export default class extends React.Component {
constructor(props, context) {
super(props, context);
this._columns = [
{
key: 'id',
name: 'ID',
resizable: true,
width: 40
},
{
key: 'task',
name: 'Title',
resizable: true
}
];
this.createRows();
this.state = null;
}
createRows = () => {
const rows = [];
for (let i = 1; i <= 2; i++) {
rows.push({
id: i,
task: …Run Code Online (Sandbox Code Playgroud)