简体   繁体   English

React Typescript Antd 表(expandedRowRender)过滤器

[英]React Typescript Antd Table (expandedRowRender) filter

I'm trying to filter my Language Lines to each no column, but it just print all Language data into all Lines:我正在尝试将我的语言行过滤到每个无列,但它只是将所有语言数据打印到所有行中:

The box marks the only dataitem that should be in the Row:该框标记了应该在行中的唯一数据项:

在此处输入图像描述

And this is the Code for the Columns:这是列的代码:

const expandedRowRender = () => {
  columns = [
    {
      title: "Sprache",
      key: "no",
      render: () => {
        return (
          <Space direction="vertical">
            <Text>{MediaRecorder.de}</Text>
            <Text>{MediaRecorder.end}</Text>
          </Space>
        );
      },
    },
  ];
  return (
    <Table
      columns={columns}
      dataSource={this.StaticRange.question}
      rowKey={(record) => record.no}
    />
  );
};

expandedRowRenderer has arguments that you can use for filtering your inner table based on parent table data. expandRowRenderer 具有 arguments,您可以使用它来根据父表数据过滤您的内部表。

const expandedRowRender = (record, index, indent, expanded) => {
  //you can use record here to filter datasource
  columns = [
    {
      title: "Sprache",
      key: "no",
      render: () => {
        return (
          <Space direction="vertical">
            <Text>{MediaRecorder.de}</Text>
            <Text>{MediaRecorder.end}</Text>
          </Space>
        );
      },
    },
  ];
  return (
    <Table
      columns={columns}
      dataSource={this.StaticRange.question}
      rowKey={(record) => record.no}
    />
  );
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM