Я хотел бы создать редактируемую таблицу, как показано в демонстрационной версии sheet .Я последовал этому примеру , но не повезло.Ниже приведен пример кода, который я пробовал, но редактируемая таблица не отображается.Любая помощь приветствуется.
import React, { Component } from 'react';
import XLSX from 'xlsx';
class LedgerGroup extends Component {
constructor(props) {
super(props);
this.state = {
data: [[["a","b"],[1,2]]], /* Array of Arrays e.g. [["a","b"],[1,2]] */
cols: [{ name: "C", K: 2 }] /* Array of column objects e.g. { name: "C", K: 2 } */
};
}
render() {
return (
<OutTable data={this.state.data} cols={this.state.cols} />
);
}
}
export default LedgerGroup;
class OutTable extends Component {
constructor(props) { super(props); };
render() { return (
<div className="table-responsive">
<table className="table table-striped">
<thead>
<tr>{this.props.cols.map((c) => <th key={c.key}>{c.name}</th>)}</tr>
</thead>
<tbody>
{this.props.data.map((r,i) => <tr key={i}>
{this.props.cols.map(c => <td key={c.key}>{ r[c.key] }</td>)}
</tr>)}
</tbody>
</table>
</div>
); };
};