Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1206] TreeGrid > Highlight Focusing Bug #1207

Merged
merged 2 commits into from
Jun 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/components/treeGrid/TreeGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
<grid-pagination
v-if="usePage && !isInfinite"
v-model="currentPage"
:total="pageTotal"
:total="showTreeStore.length"
:per-page="perPage"
:visible-page="visiblePage"
:show-page-info="showPageInfo"
Expand Down Expand Up @@ -543,19 +543,21 @@ export default {
highlightNode.show = true;
highlightNode.isFilter = true;
setParentShow(highlightNode);
// tree 에 보여지는 데이터 기준으로 index 다시 구하기
const highlightIndex = stores.showTreeStore
.map(node => node.index)
.indexOf(highlightNode.index);
if (pageInfo.usePage && !pageInfo.isInfinite) {
const highlightNodeIndex = (stores.showTreeStore
.map(node => node.index)
.indexOf(highlightNode.index)
) + 1; // tree 에 보여지는 데이터 기준으로 index 다시 구하기
pageInfo.highlightPage = Math.ceil(highlightNodeIndex / pageInfo.perPage) || 1;
const page = Math.ceil(highlightIndex / pageInfo.perPage);
pageInfo.highlightPage = highlightIndex === pageInfo.perPage ? page + 1 : page || 1;
// 페이지 이동
if (pageInfo.highlightPage !== pageInfo.currentPage) {
pageInfo.currentPage = pageInfo.highlightPage;
pageInfo.isHighlight = true;
return;
}
}
elementInfo.body.scrollTop = resizeInfo.rowHeight * styleInfo.highlightIdx;
elementInfo.body.scrollTop = resizeInfo.rowHeight * highlightIndex;
}
},
);
Expand Down Expand Up @@ -640,7 +642,10 @@ export default {
}
updateVScroll();
if (current === pageInfo.highlightPage && pageInfo.isHighlight) {
elementInfo.body.scrollTop = resizeInfo.rowHeight * styleInfo.highlightIdx;
const highlightIndex = stores.pagingStore
.map(node => node.index)
.indexOf(styleInfo.highlightIdx);
elementInfo.body.scrollTop = resizeInfo.rowHeight * highlightIndex;
pageInfo.isHighlight = !pageInfo.isHighlight;
}
});
Expand Down