i am having id of nodes (key) , i want to highlight those node, for empty node the same condition works fine. ex :
checkEmptyNodes() {
const emptyNodes = [];
const diagDetails = this.myserv.getDiagramData();
if (!!diagDetails.nodeDataArray) {
diagram.startTransaction('checking empty nodes');
diagram.nodes.each(n => {
if (!n.part.data.answer) {
emptyNodes.push(n);
}
});
diagram.highlightCollection(emptyNodes);
console.log(emptyNodes);
} else {
// data.answer = [];
}
diagram.commitTransaction('checking empty nodes');
return emptyNodes;
}
the above code works but i have a similar code which is not giving any error but nodes are not getting highlighted
changeNodeColor(broken){
const brokenNodes = [];
diagram.nodes.each(n => {
if (broken.includes(n.Zd.key)) {
diagram.startTransaction('checking hanging nodes');
brokenNodes.push(n);
}
});
console.log("data here nk data");
console.log(brokenNodes);
diagram.highlightCollection(brokenNodes);
diagram.commitTransaction('checking hanging nodes');
return brokenNodes;
}
i have really no clue how the previous one work and why the second work does not . any gojs expert.