Export to csv displays [object object] for complex data column
When I am trying to export to csv it works fine for simple data but for array of objects it does not export correctly.while i am displaying correctly in table.
Could anyone assist with this one? I have the same problem, data object have subobjects, not flat structure
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.
Can you share the object and how you display it?
Well, we experience the very same case with an array of objects. The following field is being passed to the Material-Table:
[{
active: true,
name: 'foobar'
}, {
active: false,
name: 'test'
}]
The render enables us to loop / iterate over the entries and define how the content will be rendered. Is there any way, to do the very same for the plain text (export) content? I'd think of it as a callback function, that is being triggered by the export feature, which enables the column to define it's own export logic.
{
title: t('users.roles'),
field: 'roles',
render: rowData => (
<>
{_.map(rowData.roles, role => {
return <span className={(rowData.active) ? classes.roleLabel : classes.disabledRoleLabel}>{role.name}</span>
})}
</>
),
// this would be the optional callback function
// it passes the rowData and enables the user to specify custom behaviours
// in this case, we would convert the value to a comma-separated list
export: rowData => {
return rowData.roles.map(role => role.name).join(',')
}
}
I think that would be a great addition. Can you create a PR to address this?
This is very much needed here too, we are able to render and customFilterAndSearch but sadly unable to export.
Same here, would be a great feature.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.
It's unfortunate to see this issue is being marked as stale, any progress guys?
And also, if my columns have any jsx elements like
{
field: "name",
title: <b>{"Name"}</b>,
width: 370,
}
this one when I export I get column header as [object Object] any callback or anyother API which I can make to export as plain text ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.
having the same error.
This project was abandoned by the owner . Please move to material-table-core for the community fork.
This project was abandoned by the owner . Please move to material-table-core for the community fork.
abandoned?
same error