From 98db91bd2fdf46e3351aa9e9a023bd7d893466ea Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Wed, 15 Sep 2021 20:49:08 +0800 Subject: [PATCH] fix: incorrect locating after sorting --- gui/src/node.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gui/src/node.vue b/gui/src/node.vue index f3a06c65..1b5d2237 100644 --- a/gui/src/node.vue +++ b/gui/src/node.vue @@ -899,8 +899,17 @@ export default { // solid tabIndex = 2; } - nodes = nodes[tabIndex].querySelectorAll("tbody tr"); - const node = nodes[which.id - 1]; + nodes = nodes[tabIndex].querySelectorAll("table > tbody > tr"); + const node = Array.from(nodes).find( + node => + parseInt( + node.querySelector('td[data-label="ID"]')?.textContent + ) === which.id + ); + if (!node) { + console.warn("node not found"); + return; + } node.scrollIntoView({ block: "end", inline: "center" }); let highlightClass = "highlight-row-connected"; if (that.runningState.running !== that.$t("common.isRunning")) {