mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 19:49:06 +08:00
feat(FE:TraceGanttChart): scroll to selected row on page load (#213)
* feat(FE:TraceGanttChart): scroll to selected scroll on page load * refactor: update handleScroll * refactor(traceGanttChart): scroll on selected row
This commit is contained in:
parent
27e2ceffaa
commit
beb15e0a5f
@ -57,7 +57,7 @@ const TraceGanttChart = ({
|
||||
}
|
||||
setTabsContainerWidth(tabsContainer?.offsetWidth);
|
||||
}
|
||||
// handleScroll(selectedSpan?.id);
|
||||
handleScroll(selectedSpan?.id);
|
||||
}, [sortedTreeData, treeData, clickedSpan]);
|
||||
|
||||
useEffect(() => {
|
||||
@ -229,7 +229,7 @@ const TraceGanttChart = ({
|
||||
};
|
||||
|
||||
const handleResetFocus = () => {
|
||||
let rows = document.querySelectorAll("#collapsable table tbody tr");
|
||||
const rows = document.querySelectorAll("#collapsable table tbody tr");
|
||||
Array.from(rows).map((row) => {
|
||||
row.classList.remove("hide");
|
||||
});
|
||||
@ -237,16 +237,13 @@ const TraceGanttChart = ({
|
||||
resetZoom(true);
|
||||
};
|
||||
|
||||
const handleScroll = (id) => {
|
||||
let rows = document.querySelectorAll("#collapsable table tbody tr");
|
||||
const table = document.querySelectorAll("#collapsable table");
|
||||
Array.from(rows).map((row) => {
|
||||
let attribKey = row.getAttribute("data-row-key");
|
||||
if (id === attribKey) {
|
||||
let scrollValue = row.offsetTop;
|
||||
table[1].scrollTop = scrollValue;
|
||||
}
|
||||
});
|
||||
const handleScroll = (id: string): void => {
|
||||
if (!isEmpty(id)) {
|
||||
const selectedRow = document.querySelectorAll<HTMLElement>(
|
||||
`[data-row-key='${id}']`,
|
||||
);
|
||||
selectedRow?.[0]?.scrollIntoView();
|
||||
}
|
||||
};
|
||||
|
||||
const rowSelection = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user