Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 308
Adil Avatar asked Jul 05 '17 11:07

Adil


1 Answers

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

like image 136
Jesper We Avatar answered Nov 13 '22 08:11

Jesper We