.NET 核心 3.1 反应数据网格 tutorials/examples

.NET core 3.1 react-data-grid tutorials/examples

我有一个 .net core 3.1 React Web 应用程序。我对使用 adazzle 的 react-data-grid 很感兴趣,但我无法找到任何示例实现。 .net core 中是否有 react-data-grid 的示例?

我熟悉 jquery 数据表

如果您使用所需的所有代码访问他们的examples. Just click Sandbox on the example grid and it opens a new codesandbox

使用 .net-core 3.1? 唯一需要做的就是将数据传入和传出服务器。除此之外,您在前端使用 JSTS

这是一个基本示例

import React from "react";
import ReactDOM from "react-dom";
import ReactDataGrid from "react-data-grid";
import "./styles.css";

const columns = [
  { key: "id", name: "ID", editable: true },
  { key: "title", name: "Title", editable: true },
  { key: "complete", name: "Complete", editable: true }
];

const rows = [
  { id: 0, title: "Task 1", complete: 20 },
  { id: 1, title: "Task 2", complete: 40 },
  { id: 2, title: "Task 3", complete: 60 }
];

class Example extends React.Component {
  state = { rows };

  onGridRowsUpdated = ({ fromRow, toRow, updated }) => {
    this.setState(state => {
      const rows = state.rows.slice();
      for (let i = fromRow; i <= toRow; i++) {
        rows[i] = { ...rows[i], ...updated };
      }
      return { rows };
    });
  };
  render() {
    return (
      <ReactDataGrid
        columns={columns}
        rowGetter={i => this.state.rows[i]}
        rowsCount={3}
        onGridRowsUpdated={this.onGridRowsUpdated}
        enableCellSelect={true}
      />
    );
  }
}

const rootElement = document.getElementById("root");
ReactDOM.render(<Example />, rootElement);