Skip to content

Commit 59d4a8e

Browse files
Merge pull request #2057 from iamfaran/feat/table-download
[Feat]: #1795 Table download
2 parents 76017d5 + 9d5e0aa commit 59d4a8e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

client/packages/lowcoder/src/comps/comps/tableComp/tableComp.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,15 @@ export class TableImplComp extends TableInitComp implements IContainer {
9999
}
100100

101101
downloadData(fileName: string) {
102+
// displayData already contains only visible columns (filtered in transformDispalyData)
103+
const displayData = (this as any).exposingValues["displayData"];
104+
const delimiter = this.children.toolbar.children.columnSeparator.getView();
105+
102106
saveDataAsFile({
103-
data: (this as any).exposingValues["displayData"],
107+
data: displayData,
104108
filename: fileName,
105109
fileType: "csv",
106-
delimiter: this.children.toolbar.children.columnSeparator.getView(),
110+
delimiter,
107111
});
108112
}
109113

client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ export function transformDispalyData(
209209
return oriDisplayData.map((row) => {
210210
const transData = _(row)
211211
.omit(OB_ROW_ORI_INDEX)
212-
.mapKeys((value, key) => dataIndexTitleDict[key] || key)
212+
.pickBy((value, key) => key in dataIndexTitleDict) // Only include columns in the dictionary
213+
.mapKeys((value, key) => dataIndexTitleDict[key])
213214
.value();
214215
if (Array.isArray(row[COLUMN_CHILDREN_KEY])) {
215216
return {

0 commit comments

Comments
 (0)