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?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x