Is there a way to order the csv column in a specific order?
LeCoupa opened this issue · 2 comments
LeCoupa commented
Is there a way to order the csv column in a specific order?
zheeeng commented
Not yet, columns are calculated and ordered by the JS engine.
Maybe we could add a customization function to configure meta info?
exportFromJSON({
data,
fileName,
exportType,
fields: ['name', 'age', 'gender', 'grade']
})
or
const fieldNameMap = {
'name': 'nickname'
}
const fieldNameOrder = ['name', 'age', 'gender', 'grade']
exportFromJSON({
data,
fileName,
exportType,
fields: (field) => ({
$index: fieldNameOrder.indexOf(fied),
$name: fieldNameMap[field] || field,
})
})
zheeeng commented
beforeTableEncode
gives us the chance to sort columns and rows. try 1.3.9