diff --git a/lib/dtable/dev.ts b/lib/dtable/dev.ts index a67345653b..e52c5c64d3 100644 --- a/lib/dtable/dev.ts +++ b/lib/dtable/dev.ts @@ -37,7 +37,7 @@ onPageUpdate(() => { const customColsTable = new DTable('#customColsTable', { cols: [ {name: 'id', title: 'ID', width: 80, fixed: 'left', sortType: 'desc', checkbox: true}, - {name: 'name', title: '项目名称', minWidth: 200, flex: 1, sortType: true, nestedToggle: true, childLabel: '子'}, + {name: 'name', title: '项目名称', minWidth: 200, fixed: 'left', flex: 1, sortType: true, nestedToggle: true, childLabel: '子'}, {name: 'manager', title: '负责人', sortType: true, border: true, width: 200}, {name: 'storyScale', title: '需求规模', sortType: true}, {name: 'executionCount', title: '执行数', sortType: true}, diff --git a/lib/dtable/src/plugins/sort-col/index.tsx b/lib/dtable/src/plugins/sort-col/index.tsx index 1f978f110b..d626f29421 100644 --- a/lib/dtable/src/plugins/sort-col/index.tsx +++ b/lib/dtable/src/plugins/sort-col/index.tsx @@ -173,21 +173,17 @@ const sortColPlugin: DTableSorColPlugin = { return; } - const {from, element, offset} = sortColInfo; + const {from, element} = sortColInfo; const $cells = $(element).closest('.dtable-cells'); const bounding = $cells[0]!.getBoundingClientRect(); - const width = bounding.width; - const pos = event.clientX - bounding.left - offset; - if ((pos + from.width) < 0 || (pos - from.width) > width) { - return sortColInfo.state; - } + const pos = event.clientX - bounding.left; const {cols, scrollLeft} = this.layout; const sideCols = cols[from.side].list; if (sideCols.length <= 1) { return sortColInfo.state; } const left = scrollLeft + pos; - const to = sideCols.find(col => col.name !== from.name && col.visible && col.left <= left && (col.left + col.width) > left); + const to = sideCols.find(col => col.visible && col.left <= left && (col.left + col.width) > left); if (!to) { return sortColInfo.state; }