Skip to content

Commit 0a2de8c

Browse files
committed
bug fixed
1 parent 20a1b69 commit 0a2de8c

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

packages/ve-table/src/header/header-th.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,6 @@ export default {
287287
currentField,
288288
sortResult,
289289
});
290-
291-
this.dispatch(COMPS_NAME.VE_TABLE, EMIT_EVENTS.SORT_CHANGE, {
292-
currentField,
293-
sortResult,
294-
});
295290
},
296291

297292
// get sort content

packages/ve-table/src/header/index.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { clsName } from "../util";
22
import HeaderTr from "./header-tr";
33
import { COMPS_NAME, EMIT_EVENTS } from "../util/constant";
4+
import emitter from "../../../src/mixins/emitter";
45
export default {
56
name: COMPS_NAME.VE_TABLE_THADER,
7+
mixins: [emitter],
68
props: {
79
columnsOptionResetTime: {
810
type: Number,
@@ -97,6 +99,12 @@ export default {
9799
}
98100
}
99101

102+
this.dispatch(
103+
COMPS_NAME.VE_TABLE,
104+
EMIT_EVENTS.SORT_CHANGE,
105+
sortColumns,
106+
);
107+
100108
// invoke
101109
sortChange(sortColumns);
102110
},

packages/ve-table/src/index.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,13 @@ export default {
638638
}, 0),
639639

640640
// update colgroups by sort change
641-
updateColgroupsBySortChange({ currentField, sortResult }) {
641+
updateColgroupsBySortChange(sortColumns) {
642642
this.colgroups = this.colgroups.map((item) => {
643-
if (item.field && item.field === currentField) {
644-
item.sortBy = sortResult;
643+
// update colgroups by sort columns
644+
if (Object.keys(sortColumns).indexOf(item.field) > -1) {
645+
item.sortBy = sortColumns[item.field];
645646
}
647+
646648
return item;
647649
});
648650
},

0 commit comments

Comments
 (0)