Tree Mapper GoJs How to closed items onMounted

carolina_nio_7c6147697b1

Carolina Niño

Posted on July 5, 2024

Tree Mapper GoJs How to closed items onMounted

https://gojs.net/latest/samples/treeMapper.html, Dear GOJS community, I am new to this topic and I would like to know if any of you can tell me how I can make it render the collapsed nodes from the beginning and then allow me to open and close, but initially appear closed. I have tried some functions in the onmounted but it does not appear closed,
diagram.delayInitialization(() => {
const nodes = diagram.model.nodeDataArray;

for (let i = 0; i < nodes.length; i++) {
const nodeData = nodes[i]; // Access element by index
console.log("nodeData", nodeData, "group", nodeData.isGroup)
if (nodeData.isGroup && (nodeData.key === -1 || nodeData.key === -2 || nodeData.key === -3)) {
nodeData.isTreeExpanded = false;
nodes[i] = nodeData; // Update element in the original array
}
}

diagram.model.nodeDataArray = nodes; // Update the model after all changes
});

Thanks

Estimada comunidad GOJS, soy nueva en este tema y me gustaría saber si alguno de ustedes puede decirme como puedo hacer para que renderice los nodos colapsados desde el inicio y que luego me permita abrir y cerrar, pero que inicialmente me aparezca cerrado. He intentado unas funciones en el onmounted pero no me aparece cerrado,
diagram.delayInitialization(() => {
const nodes = diagram.model.nodeDataArray;

for (let i = 0; i < nodes.length; i++) {
const nodeData = nodes[i]; // Access element by index
console.log("nodeData", nodeData, "group", nodeData.isGroup)
if (nodeData.isGroup && (nodeData.key === -1 || nodeData.key === -2 || nodeData.key === -3)) {
nodeData.isTreeExpanded = false;
nodes[i] = nodeData; // Update element in the original array
}
}

diagram.model.nodeDataArray = nodes; // Update the model after all changes
});
Gracias,

💖 💪 🙅 🚩
carolina_nio_7c6147697b1
Carolina Niño

Posted on July 5, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related