react-data-export icon indicating copy to clipboard operation
react-data-export copied to clipboard

[feature] Added nested object key access for data and column match

Open mehmetyilmaz001 opened this issue 3 years ago • 0 comments

The following has been addressed in the PR:

  • There is a related #164

Description:

[feature]

Accessing nested object is available with this PR

In the value prop of ExcelColumn, you can now provide nested object path like "user.name" as in the example

const dataSet = [
  {
     user: {name: 'Mehmet', surname: 'Yılmaz'},
     period: 'Eylül - Ekim'
  },

  {
     user: {name: 'Semih', surname: 'Yavuz'},
     period: 'Haziran - Temmuz'
  }
]


class Download extends React.Component {
    render() {
        return (
            <ExcelFile>
                <ExcelSheet data={dataSet} name="Employees">
                    <ExcelColumn label="Name" value="user.name"/>
                    <ExcelColumn label="Period" value="period"/>
                </ExcelSheet>
            </ExcelFile>
        );
    }
}

mehmetyilmaz001 avatar Oct 09 '21 17:10 mehmetyilmaz001