Skip to content

如何实现这种具有编辑与校验功能的表格 #2163

Answered by pointhalo
bbcvc asked this question in Q&A
Discussion options

You must be logged in to vote
  1. +1,同上。Column render可以是任意 ReactNode。你结合 Form 的 Field Component 一起使用就行。

import React from 'react';
import { Table, Avatar } from '@douyinfe/semi-ui';
import { IconMore } from '@douyinfe/semi-icons';

var gene = (row, column) => {
    const columns = [];
    for (let i = 0; i < column; i++) {
        let cur = {
            title: `c-${i}`,
            dataIndex: `c-${i}`,
            width: 200,
            render: (text, record, rowIndex) => {
                return <Form.Input field={`data[${rowIndex}][c-${i}]`} pure style={{ width: 120 }} />;
            }
        };
        columns.push(cur);
    }

    let data = [];
    for (let i = 0; i < row; i++) {
        const currentRow = {};…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bbcvc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants