mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 18:29:00 +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);
|
setTabsContainerWidth(tabsContainer?.offsetWidth);
|
||||||
}
|
}
|
||||||
// handleScroll(selectedSpan?.id);
|
handleScroll(selectedSpan?.id);
|
||||||
}, [sortedTreeData, treeData, clickedSpan]);
|
}, [sortedTreeData, treeData, clickedSpan]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -229,7 +229,7 @@ const TraceGanttChart = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleResetFocus = () => {
|
const handleResetFocus = () => {
|
||||||
let rows = document.querySelectorAll("#collapsable table tbody tr");
|
const rows = document.querySelectorAll("#collapsable table tbody tr");
|
||||||
Array.from(rows).map((row) => {
|
Array.from(rows).map((row) => {
|
||||||
row.classList.remove("hide");
|
row.classList.remove("hide");
|
||||||
});
|
});
|
||||||
@ -237,16 +237,13 @@ const TraceGanttChart = ({
|
|||||||
resetZoom(true);
|
resetZoom(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleScroll = (id) => {
|
const handleScroll = (id: string): void => {
|
||||||
let rows = document.querySelectorAll("#collapsable table tbody tr");
|
if (!isEmpty(id)) {
|
||||||
const table = document.querySelectorAll("#collapsable table");
|
const selectedRow = document.querySelectorAll<HTMLElement>(
|
||||||
Array.from(rows).map((row) => {
|
`[data-row-key='${id}']`,
|
||||||
let attribKey = row.getAttribute("data-row-key");
|
);
|
||||||
if (id === attribKey) {
|
selectedRow?.[0]?.scrollIntoView();
|
||||||
let scrollValue = row.offsetTop;
|
}
|
||||||
table[1].scrollTop = scrollValue;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowSelection = {
|
const rowSelection = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user