DataTable exportCSV when column has body prop

UI Components for React
Post Reply
Hanland
Posts: 24
Joined: 07 Jan 2018, 14:12

27 Jan 2019, 14:11

Hi,

I have a DataTable with body props, when exportCSV is used these cells appear as undefined? Is there an answer to this?

Regards

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

15 Feb 2019, 16:36

Hi,
We tried in datatable-templating page like;

Code: Select all

<DataTable value={this.state.cars} header={header} footer={footer} ref={(el) => { this.dt = el; }}>
                        <Column field="vin" header="Vin" />
                        <Column field="year" header="Year" />
                        <Column field="brand" header="Brand" body={this.brandTemplate} style={{textAlign:'center'}}/>
                        <Column field="color" header="Color" body={this.colorTemplate} />
                        <Column body={this.actionTemplate} style={{textAlign:'center', width: '8em'}}/>
                    </DataTable>
but we didnt see your issue ? Please, could you send your code or create an example like this https://codesandbox.io/s/0v8v2znl0 ?

archprime
Posts: 1
Joined: 12 Nov 2019, 19:11

12 Nov 2019, 19:16

Is this issue resolved? I have the same issue. I use body prop to format the data in a column. When I try to use exportCSV on datatable, the format is not preserved. As a result, the csv file shows [object] in these columns. I am wondering if there is a way to format data before using exportCSV. Thanks!

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests