Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f3cd13b

Browse files
fix sorting for custom columns and columns with nested data map in table
1 parent 416d559 commit f3cd13b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,21 @@ export class TableImplComp extends TableInitComp implements IContainer {
325325
...row,
326326
[OB_ROW_ORI_INDEX]: index + "",
327327
}));
328+
const updatedDataMap: Record<string, RecordType> = {};
329+
updatedData.forEach((row) => {
330+
updatedDataMap[row[OB_ROW_ORI_INDEX]] = row;
331+
})
328332
const originalData = getOriDisplayData(updatedData, 1000, Object.values(dataColumns))
329-
const sortedData = sortData(data, sortColumns, sort);
333+
const sortedData = sortData(originalData, sortColumns, sort);
334+
330335
// console.info( "sortNode. data: ", data, " sort: ", sort, " columns: ", columns, " sortedData: ", sortedData);
331-
return sortedData;
336+
const newData = sortedData.map(row => {
337+
return {
338+
...row,
339+
...updatedDataMap[row[OB_ROW_ORI_INDEX]],
340+
}
341+
});
342+
return newData;
332343
});
333344
return lastValueIfEqual(this, "sortedDataNode", [sortedDataNode, nodes] as const, (a, b) =>
334345
shallowEqual(a[1], b[1])

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /