1

这是第一次在 ReactJS 中使用 Datatable,在我的 API 中我有带有子行的列,我不知道该怎么做。并且没有可用的示例。如果有人可以帮助我提供一些建议,我将不胜感激。谢谢!

这是我到目前为止所做的:

const columns = [
    {
      name: "Identification",
      selector: row => row.Identification,
    },
    {
      name: "Sequence Number",
      selector: row => row.SequenceNumber,
    },
    {
      name: "Name",
      selector: row => row.Name,
    },
    {
      name: "Type",
      selector: row => row.Type,
    },
    {
      name: "Photo",
      selector: row => <img height="30px" width="30px" alt={row.Identification} src={row.Photo} />
    },
    {
      name: "Customer Segment",
      selector: row => row.CustomerSegment,
      cell: (d) => <span>{d.CustomerSegment.join(", ")}</span>,
    },
    {
      name: "Service and Facility",
      selector: row => row.ServiceAndFacility,
    },
    {
      name: "Accessibility",
      selector: row => row.Accessibility,
    },
    {
      name: "Other Service and Facility",
      selector: row => row.OtherServiceAndFacility,
    },

这是它在 API 中的样子: API

4

0 回答 0