Commit f05cc6d34e935c342e1f7ada6692ea0178b7c984

Authored by qinjiahui01
Committed by GitHub
1 parent 8b5cbca3

fix(useColumn): fixed table column changes with hidden columns disappearing after dropping (#453)

Co-authored-by: Alan <alan@ichestnuts.com>
src/components/Table/src/hooks/useColumns.ts
... ... @@ -207,6 +207,11 @@ export function useColumns(
207 207 ...item,
208 208 defaultHidden: false,
209 209 });
  210 + } else {
  211 + newColumns.push({
  212 + ...item,
  213 + defaultHidden: true,
  214 + });
210 215 }
211 216 });
212 217  
... ... @@ -214,8 +219,8 @@ export function useColumns(
214 219 if (!isEqual(cacheKeys, columns)) {
215 220 newColumns.sort((prev, next) => {
216 221 return (
217   - columnKeys.indexOf(prev.dataIndex as string) -
218   - columnKeys.indexOf(next.dataIndex as string)
  222 + cacheKeys.indexOf(prev.dataIndex as string) -
  223 + cacheKeys.indexOf(next.dataIndex as string)
219 224 );
220 225 });
221 226 }
... ...