i’m trying to have a “rebuild” button on my page where i’m displaying the diagram.
this will be used in instances where a user has expanded/collapsed all the nodes, or has edited some parent/child relationships and they wish to rebuild the diagram to the original state.
refreshing the data is not efficient as the data doesn’t change very often and mostly will only change in future releases of our app using the editing of this diagram.
i have tried to make another hidden text area to store the json data, set the modeldata to this (document.getElementById(“modelData”).value = document.getElementById(“originalData”).value;) and then calling init() but receive the following error: <span role=“presentation” =" -errorMessage hasBreakSwitch "><span ="errorMessage "> Invalid div id; div already has a Diagram associated with it.
the code looks like:
myDiagram.clear();
document.getElementById(“modelData”).value = document.getElementById(“modelDataOriginal”).value;
init();
i’ve also tried:
document.getElementById(“modelData”).value = document.getElementById(“modelDataOriginal”).value;
myDiagram.startTransaction(“rebuildDiagram”);
myDiagram.rebuildParts();
myDiagram.commitTransaction(“rebuildDiagram”);
but all that happens is the diagram clearing and nothing being rebuilt.
what is the appropriate/preferred way to reload the diagram w/o reloading the entire page?
thanks for the help.