Firstly, thank you for this and example set, it helped me a lot.
I had a situation where, I was fetching details from the database, and it had a nested Object, but the export part would only export non-nested fields.
I was able to achieve exporting nested Object, with the help of by changing
|
for (const objKey in obj) { |
|
if (Object.hasOwn(naming,objKey)) { |
|
tempObj[naming[objKey]] = obj[objKey]; |
|
} |
|
} |
To
Object.keys(obj).forEach(key => {
if (typeof obj[key] === "object") {
Object.keys(obj[key]).forEach(nestedKey => {
if (naming[nestedKey]) {
tempObj[naming[nestedKey]] = obj[key][nestedKey];
}
});
} else {
if (naming[key]) {
tempObj[naming[key]] = obj[key];
}
}
});
Firstly, thank you for this and example set, it helped me a lot.
I had a situation where, I was fetching details from the database, and it had a nested
Object, but the export part would only export non-nested fields.I was able to achieve exporting nested Object, with the help of by changing
React-Advance-Table/lib/exportExcel.ts
Lines 19 to 23 in 12fb077
To