I implemented the same code in confluence page and it doesn't even work. I am sure my code is not the problem because it worked offline on a downloaded version of the confluence page and a simple html table I made before.
function filter_rows(index, parentID) {
var rows = document.getElementById("element_matrix").rows;
var options = document.getElementById(parentID).getElementsByTagName('label')
var checkboxes = document.getElementById(parentID).getElementsByTagName('input')
for (let i = 0; i < options.length; i++) {
if (checkboxes[i].checked) {
if (!hashmapOfoptions[index].includes(options[i].innerText)) {
hashmapOfoptions[index].push(options[i].innerText)
}
} else {
hashmapOfoptions[index] = hashmapOfoptions[index].filter(item => item !== options[i].innerText)
}
}
for (var row = 1; row < rows.length; row++) {
var cols = rows[row].cells;
willHideRow = true
for (let j = 0; j < cols.length; j++) {
willHideRow &= hashmapOfoptions[j].includes(cols[j].innerText)
}
if (!willHideRow) {
rows[row].style.display = 'none'
} else {
rows[row].style.display = '' // this
}
}
}
When using a debugger I noticed all lines are executed but their effects don't always happen.