Skip to content

Commit

Permalink
fix(useColumn): fixed table column changes with hidden columns disapp…
Browse files Browse the repository at this point in the history
…earing after dropping (#453)

Co-authored-by: Alan <[email protected]>
  • Loading branch information
qinjiahui01 and Alan authored Apr 7, 2021
1 parent 8b5cbca commit f05cc6d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/Table/src/hooks/useColumns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,20 @@ export function useColumns(
...item,
defaultHidden: false,
});
} else {
newColumns.push({
...item,
defaultHidden: true,
});
}
});

// Sort according to another array
if (!isEqual(cacheKeys, columns)) {
newColumns.sort((prev, next) => {
return (
columnKeys.indexOf(prev.dataIndex as string) -
columnKeys.indexOf(next.dataIndex as string)
cacheKeys.indexOf(prev.dataIndex as string) -
cacheKeys.indexOf(next.dataIndex as string)
);
});
}
Expand Down

0 comments on commit f05cc6d

Please sign in to comment.