Using antd column render to display percentage of another column

  antd, javascript, reactjs

Another probably simple problem I’m overlooking. Within my columns:

    {
      title: 'Min. Value',
      dataIndex: 'min_value',
      render: min_value => `${min_value}`,
      width: '10',
    },
    {
      title: 'Max Value',
      dataIndex: 'max_value',
      render: max_value => `${max_value}`,
      width: '15',
    },
    {
      title: 'Min. Commission',
      dataIndex: 'min_commission',
      render: row => {row.min_value},
      width: '15',
    },
    {
      title: 'Max Commission',
      dataIndex: 'max_commission',
      render: max_value => `${max_value}`,
      width: '15',
    },

I’m trying to use the render option in min_commission and max_commission to display a percentage of their respective min/max value columns. What’s shown currently in min_commission is just trying to display the data from min_value.

Which just gives the error:

Failed to compile
./src/components/LeaderBoard.js
  Line 65:23:  Expected an assignment or function call and instead saw an expression  no-unused-expressions

Search for the keywords to learn more about each error.

I’ve been a bit stuck just trying to display the data from the other column. I feel like that’s the first step I need before I can worry about adding in a percentage calculation, I just can’t work out how to pull the data. The current row => {row.min_value} was based off another thread I had found with an almost similar situation, so I thought it might work.

Source: Ask Javascript Questions

LEAVE A COMMENT