Maybe it is a late response, but for others to use maybe.
But we figured out that if you find the element where the collapse is on, get the hcEvents and then remove the listeners, you disable the click
in code, it looks like this. Be aware that you need a timeout to find the element because it takes some time to load the SVG elements into the dom:
This is code used in our vue module, of course, you can adjust what you want to adjust to the elements found
Vue.nextTick(() => {
setTimeout(() => {
// Get the label which can be collapsed (site level)
var highchartsTreegridNodeLevel1Elements = this.getSvgElemByClass('highcharts-treegrid-node-level-1')
highchartsTreegridNodeLevel1Elements.forEach((item) => {
if (item.hcEvents !== undefined) {
if (item.hcEvents.click !== undefined) {
if (item.hcEvents.click.length > 0) {
item.removeEventListener('click', item.hcEvents.click[0].fn)
}
}
if (item.hcEvents.mouseover !== undefined) {
if (item.hcEvents.mouseover.length > 0) {
item.removeEventListener('mouseover', item.hcEvents.mouseover[0].fn)
}
}
}
})
// Get the icon in front which can be collapsed (site level)
var highchartsLabelIconElements = this.getSvgElemByClass('highcharts-label-icon')
highchartsLabelIconElements.forEach((item) => {
if (item.hcEvents !== undefined) {
if (item.hcEvents.click !== undefined) {
if (item.hcEvents.click.length > 0) {
item.removeEventListener('click', item.hcEvents.click[0].fn)
}
}
if (item.hcEvents.mouseover !== undefined) {
if (item.hcEvents.mouseover.length > 0) {
item.removeEventListener('mouseover', item.hcEvents.mouseover[0].fn)
}
}
}
})
// enable clicking again
// document.removeEventListener('click', prevent)
}, 2000)
and the function getSvgElemByClass
getSvgElemByClass(searchClass, node, tag) {
const classElements = []
if (node == null) { node = document }
if (tag == null) { tag = '*' }
// SVG = XML, so we need the XML method:
// using 'magic' namespace variable provided by websvg (svgns)
const els = node.getElementsByTagNameNS('
http://www.w3.org/2000/svg', tag)
const elsLen = els.length
var pattern = new RegExp('(\\b)' + searchClass + '(\\b)')
var j = 0
var i = 0
for (i = 0; i < elsLen; i++) {
// inspect
// SVG specific helper
if (els
.hasAttribute('class') && pattern.test(els.getAttribute('class'))) {
classElements[j] = els
j++
} else if (pattern.test(els.className)) {
classElements[j] = els
j++
}
}
return classElements
}