Get value of another column in an ant.design Table's column?

adi picture adi · Jul 5, 2017 · Viewed 11k times · Source

In my react and ant.design based app, I've a table with the following columns.

const tableColumns = [{
      title : 'Lorem',
      dataIndex : 'lorem'
      render: text => <a href='#'> {text + ipsum} </a>
    }, {
      title : 'Ipsum',
      dataIndex : 'ipsum'
    }];

I want to use value for ipsum i.e. the second column for each row inside render function of the first column. What's the best recommended way in ant.design to fetch second column's value here?

Answer

Jesper We picture Jesper We · Jul 5, 2017

The second argument to the render function is the current record:

render: (text, row) => <a> {text + row.ipsum} </a>

https://ant.design/components/table/#Column