fix: column setting index column sort (#3463)

* fix: keep rowSelection onChange call outside

* fix: ColumnSetting index column sort wrong
This commit is contained in:
xachary 2023-12-26 20:41:03 +08:00 committed by GitHub
parent 141f3bdbd0
commit fc002d3db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 18 deletions

View File

@ -113,6 +113,7 @@
import { getPopupContainer as getParentContainer } from '@/utils';
import { cloneDeep, omit } from 'lodash-es';
import Sortablejs from 'sortablejs';
import { INDEX_COLUMN_FLAG } from '@/components/Table/src/const';
//
import { useTableSettingStore } from '@/store/modules/tableSetting';
@ -210,22 +211,6 @@
showIndexColumnUpdate(e.target.checked);
// showIndexColumn
props.cache && tableSettingStore.setShowIndexColumn(e.target.checked);
//
if (e.target.checked) {
const columns = cloneDeep(table?.getColumns());
const idx = columns.findIndex((o) => o.flag === 'INDEX');
//
if (idx > -1) {
const cache = columns[idx];
// fix
cache.fixed = 'left';
// /
columns.splice(idx, 1);
columns.splice(0, 0, cache);
//
tableColumnsSet(columns);
}
}
};
//
@ -340,8 +325,15 @@
//
const columns = cloneDeep(table.getColumns());
// fixed
let count = columns.filter((o) => o.fixed === 'left' || o.fixed === true).length;
// fixed
let count = columns.filter(
(o) => o.flag !== INDEX_COLUMN_FLAG && (o.fixed === 'left' || o.fixed === true),
).length;
//
if (isIndexColumnShow.value) {
count++;
}
// columnOptions table.getColumns()
for (const opt of columnOptions.value) {