Links of the nodes are not displayed

Well first I’m working alone with jquerymovile, java, js and ajax.

this is how I call the registered data and I build the nodes I do not know if this is good or bad :/

function load() {
$.ajax({
url : “rest/rrhh/organigramamodel”,
cache : false,
success : function(data) {
for (var i = 0; i < data.length; i++) {
JSON.stringify(data);
var modeloc = $(go.Model);
modeloc.nodeDataArray =
[{}];
var nodo = data[i];
myDiagram.startTransaction(“add employee”);
if(i == 0 ) {
var nodoAcargar = { key: data[i].id_cargo , name: “” , nivel : data[i].nivel };
myDiagram.model.addNodeData(nodoAcargar);
}else if (i > 0){
var nodoAcargar = { key: data[i].id_cargo , name: “” , parent: data[i].idcargo_padre , nivel : data[i].nivel };
myDiagram.model.addNodeData(nodoAcargar);
myDiagram.commitTransaction(“add employee”);
}
}

  		},
  		error : function(error) {
  			{
  				if (error.status == 401) {
  					desAuth();
  				}
  				jqmSimpleMessage("Error en listar infor empleado: "
  						+ error.responseText);
  			}
  		},
  		beforeSend : function(xhr, settings) {
  			xhr.setRequestHeader('Authorization', 'Bearer '
  					+ getVCookie(getVCookie("userPro")));
  		}
  	});

  	}

at the moment of creating a new node this happens and it sends me message

I do not know why he no longer shows me the links of the nodes and why he does not believe me new anymore I am new with this api and I do not understand much :(

It looks like you’ve initialized a basic Model, which does not support links. You’ll want to use either a TreeModel or GraphLinksModel, depending on your graph’s expected structure.

I’d suggest taking a look at the learn page and various intro pages to familiarize yourself with GoJS. It may be easier to start with something smaller before trying to integrate with other software.

@jhardy


I think if he admits them, only when he starts calling him with that ajax function he does not link them anyway thanks for your comment

The error message is saying that you called Model.insertArrayItem with a first argument that was not an Array.