Help with library GoJs

Good morning, I am developing an application to create class diagrams but I have a problem. How can I add the methods and attributes of a modal? I already captured everything, but when I add the object to the canvas, it does not appear and an error occurs to me. I use the GoJS library

So when the modal dialog completely successfully, how are you adding the node to the diagram’s model? It should be something like what the addNodeAndLink function does in the State Chart sample, State Chart

Basically, you just want to create the node data object with the properties that you want, and then call Model.addNodeData. GoJS Using Models -- Northwoods Software

That works when I handle the modal within the GoJs canvas. Now if I manage the modal outside the canvas from a button on the palette it would work for me because I tried and I get an error.

example: here I capture all the values ​​of the class to be created.
function getDatos() {
var ambitoaux, tipoaux, nombreattaux, chechkdefaultaux, valordefaultaux;
var ambitomedaux, tipomedaux, nombremedaux, variablemedaux;
clase.nombreclase = document.getElementById(“txtNombre”).value;
('#tatributos tbody').each(function () { (this).find(“tr”).each(function () {
(this).find("td").each(function () { switch ((this).children().prop(“tagName”)) {
case “SELECT”:
if ((this).find("select").attr("id") === "cboambitoattri") { ambitoaux = (this).find(“select”).val();
} else {
tipoaux = (this).find("select").val(); } break; case "INPUT": nombreattaux = (this).find(“input”).val();
break;
case “DIV”:
chechkdefaultaux = (this).find(".c1").prop("checked"); valordefaultaux = (this).find(".c2").val();
break;
}
});
clase.atributos.push({ambito: ambitoaux, tipo: tipoaux, nombreatt: nombreattaux, chechkdefault: chechkdefaultaux, valordefault: valordefaultaux});
});
});

$('#tmetodo tbody').each(function () {
    $(this).find("tr").each(function () {
        $(this).find("td").each(function () {
            switch ($(this).children().prop("tagName")) {
                case "SELECT":
                    if ($(this).find("select").attr("id") === "cboambitometd") {
                        ambitomedaux = $(this).find("select").val();
                    } else {
                        tipomedaux = $(this).find("select").val();
                    }
                    break;
                case "INPUT":
                    if ($(this).find("input").attr("id") === "txtnamemetd") {
                        nombremedaux = $(this).find("input").val();
                    } else {
                        variablemedaux = $(this).find("input").val();
                    }
                    break;
            }
        });
        clase.metodos.push({ambitomedtodo: ambitomedaux, tipometodo: tipomedaux, nombremetodo: nombremedaux, variablemetodo: variablemedaux});
    });
});

I’m not sure what you mean, because there are no “modal dialogs” within GoJS. I would expect that all such UI be implemented in HTML.

While you are debugging it, make sure that you are getting a reference to the correct Diagram instance and then its Diagram.model, on which you can call Model.addNodeData within a transaction. Perhaps something like:

myDiagram.model.commit(function(m) {
  var data = { . . . };
   // set whatever properties are needed according to the node's template, as specified by the dialog
  m.addNodeData(data);
}, "added node");

Here I have a test to send to create. worse it marks me error:
var nodedata = [
{
key: 20,
name: “Prueba”,
properties: [
{name: “owner”, type: “String”, visibility: “public”},
{name: “balance”, type: “Currency”, visibility: “public”, default: “0”}
],
methods: [
{name: “deposit”, parameters: [{name: “amount”, type: “Currency”}], visibility: “public”},
{name: “withdraw”, parameters: [{name: “amount”, type: “Currency”}], visibility: “public”}
]
}];
myDiagram = $(go.Diagram, “myDiagramDiv”);
myDiagram.startTransaction(‘add node’);
myDiagram.model.addNodeData(nodedata);
myDiagram.commitTransaction(‘add node’);
myDiagram.requestUpdate();

You shouldn’t be creating a new Diagram all the time. Just create it once when the page loads.

Also, the call to requestUpdate is superfluous – ending a transaction will do that automatically.

Proyect https://github.com/lsinchiguano12/diagramaClase.git

??? lsinchiguano12 doesn’t have any public repositories yet.

Besides, I really don’t have the time to try to figure out what is what and how to reproduce the problem.

Did you make the change to what is clearly the problem with your code above?