Page 1 of 1

DataTable exportCSV when column has body prop

Posted: 27 Jan 2019, 14:11
by Hanland
Hi,

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

Regards

Re: DataTable exportCSV when column has body prop

Posted: 15 Feb 2019, 16:36
by merve7
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 ?

Re: DataTable exportCSV when column has body prop

Posted: 12 Nov 2019, 19:16
by archprime
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!