Reputation: 914
I am creating a react app using antd in React. I want to create an Antd Table.
I am following this syntax: https://ant.design/components/table/#components-table-demo-jsx
In the dataSource I don't want separate names like firstName or lastName. I want one array object
name:["firstName","lastName"]
The problem is I am not able to load or render this data in the <Column />
tag inside the <Table />
tag.
Upvotes: 2
Views: 11839
Reputation: 84
const columns = [
{
title: 'Name',
dataIndex: ['firstName', 'lastname'],
key: 'firstName',
render: (row) =><> {row["firstName"]} {row["lastname"]}</>
}
];
Upvotes: 0
Reputation: 365
You can render the column by your self like this
<Column
title="First Name"
key="firstName"
render={(text, record) => (
<div>{record.name[0]}</div>
)}
/>
Upvotes: 6