Просмотр исходного кода

数据视图增删列时不改变原有列顺序

zhuth 6 лет назад
Родитель
Сommit
57af470b5c
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/components/chartDesigner/sections/displayColumnBox.jsx

+ 1 - 1
src/components/chartDesigner/sections/displayColumnBox.jsx

@@ -48,7 +48,7 @@ class DisplayColumnBox extends React.Component {
 
     handleChange = (targetKeys, direction, moveKeys) => {
         const { allColumns } = this.props;
-        let targetColumns = allColumns.filter(c => targetKeys.indexOf(c.name) !== -1);
+        let targetColumns = targetKeys.map(k => allColumns.find(c => c.name === k));
         this.setState({ targetColumns });
     }