phonograph/webc/src/viewer_controller_component.ffi.mjs
2025-07-25 15:41:20 -07:00

16 lines
474 B
JavaScript

export function clearSelectedAttrs() {
document.querySelectorAll(
"table.viewer > tbody > tr > td > [selected='true']",
)
.forEach((element) => element.setAttribute("selected", ""));
}
export function setSelectedAttr(row, column) {
const tr = document.querySelectorAll("table.viewer > tbody > tr")[row];
if (tr) {
const cell = [...tr.querySelectorAll(":scope > td > *")][column];
if (cell) {
cell.setAttribute("selected", "true");
}
}
}