Browse Source
fix(useColumn): fixed table column changes with hidden columns disappearing after dropping (#453)
Co-authored-by: Alan <alan@ichestnuts.com>
pull/455/head
qinjiahui01
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
2 deletions
-
src/components/Table/src/hooks/useColumns.ts
|
|
|
@ -207,6 +207,11 @@ export function useColumns( |
|
|
|
...item, |
|
|
|
defaultHidden: false, |
|
|
|
}); |
|
|
|
} else { |
|
|
|
newColumns.push({ |
|
|
|
...item, |
|
|
|
defaultHidden: true, |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
@ -214,8 +219,8 @@ export function useColumns( |
|
|
|
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) |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
|
|