I'm trying to use an URL as hyperlink to another field in the table.
ticketurl
and ticketid
are two different name value pairs in my JSON response. I'm trying to display ticketid
, which is a hyperlink to ticketurl
:
data is json array
[
{
"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"
/>
I'm getting an empty cell.