Skip to content

Commit 1b5c54f

Browse files
committed
add scrollToColKey instance method
1 parent f186ba6 commit 1b5c54f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/ve-table/src/index.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ export default {
18661866
[INSTANCE_METHODS.SCROLL_TO](option) {
18671867
scrollTo(this.$refs[this.tableContainerRef], option);
18681868
},
1869-
// table scroll to rowKey
1869+
// table scroll to rowKey position
18701870
[INSTANCE_METHODS.SCROLL_TO_ROW_KEY]({ rowKey }) {
18711871
if (isEmptyValue(rowKey)) {
18721872
console.warn("Row key can't be empty!");
@@ -1907,6 +1907,13 @@ export default {
19071907
behavior: "smooth",
19081908
});
19091909
},
1910+
// scroll to col key position
1911+
[INSTANCE_METHODS.SCROLL_TO_COL_KEY]({ colKey }) {
1912+
const column = getColumnByColkey(colKey, this.colgroups);
1913+
if (column) {
1914+
this.columnToVisible(column);
1915+
}
1916+
},
19101917
// start editing cell
19111918
[INSTANCE_METHODS.START_EDITING_CELL]({
19121919
rowKey,

packages/ve-table/src/util/constant.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ export const INSTANCE_METHODS = {
128128
SCROLL_TO: "scrollTo",
129129
// scroll to rowKey
130130
SCROLL_TO_ROW_KEY: "scrollToRowKey",
131+
// scroll to colKey
132+
SCROLL_TO_COL_KEY: "scrollToColKey",
131133
// start editing cell
132134
START_EDITING_CELL: "startEditingCell",
133135
// stop editing cell

0 commit comments

Comments
 (0)