我正在尝试使用 URL 作为指向表中另一个字段的超链接。
ticketurl
并且ticketid
是我的 JSON 响应中的两个不同的名称值对。我正在尝试显示ticketid
,这是一个超链接ticketurl
:
数据是json数组
[
{
"index": 2,
"empId": "ammy",
"requestorId": null,
"profile": "a",
"request": "b",
"ticketId": "abc-12345",
"createdTime": "2019-07-07 18:01:15.0",
"updatedTime": "2019-07-07 18:56:26.0",
"statusurl": "www.xyz.com",
"ticketurl": "www.abc.com",
"status": "Open",
"description": "The issue is open"
}
]
<ReactTable
data={data}
columns={[
{
columns: [
{
Header: "Employee Id",
accessor: "empId"
},
{
Header: "Requestor Id",
accessor: "requestorId"
},
{
Header: "Profile",
accessor: "profile"
},
{
Header: "Request",
accessor: "request"
},
{
Header: "Ticket",
id: "link",
accessor: d => d.ticketurl,
Cell: ({ row }) => <a href={row.ticketurl}>{row.ticketid}</a>
},
{
Header: "Created Time",
accessor: "createdTime"
},
{
Header: "Updated Time",
accessor: "updatedTime"
},
{
Header: "Status",
accessor: "status"
},
{
Header: "Description",
accessor: "description"
}
]
}
]}
defaultPageSize={10}
className="-striped -highlight"
/>
我得到一个空单元格。