ciao a tutti,
qualcuno mi darebbe una mano a capire perchè non riesco a creare i figli nel componente Tree con xml
io ho fatto cosi
codice:
// Creazione di un oggetto XML
var myTreeXML = new XML();
// Creazione dei nodi
var Nodo1 = myTreeXML.createElement("node");
Nodo1.attributes.label = "TARGHE";
Nodo1.attributes.data = 0;
var Nodo2 = myTreeXML.createElement("node");
Nodo2.attributes.label = "TIMBRI";
Nodo2.attributes.data = 1;
var Nodo3 = myTreeXML.createElement("node");
Nodo3.attributes.label = "SERIGRAFIA";
Nodo3.attributes.data = 2;
var Nodo4 = myTreeXML.createElement("node");
Nodo4.attributes.label = "SEGNALETICA";
Nodo4.attributes.data = 3;
var Nodo5 = myTreeXML.createElement("node");
Nodo5.attributes.label = "PREMIAZIONI";
Nodo5.attributes.data = 4;
var Nodo6 = myTreeXML.createElement("node");
Nodo6.attributes.label = "ACCESSORI";
Nodo6.attributes.data = 5;
var Nodo9 = myTreeXML.createElement("node");
Nodo9.attributes.label = "OTTONE";
Nodo9.attributes.data = 8;
var Nodo10 = myTreeXML.createElement("node");
Nodo10.attributes.label = "ALLUMINIO";
Nodo10.attributes.data = 9;
var Nodo11 = myTreeXML.createElement("node");
Nodo11.attributes.label = "PLEXIGLASS";
Nodo11.attributes.data = 10;
var Nodo12 = myTreeXML.createElement("node");
Nodo12.attributes.label = "TELAI";
Nodo12.attributes.data = 11;
// Assegnazione dei nodi
myTreeXML.appendChild(Nodo1);
myTreeXML.appendChild(Nodo2);
myTreeXML.appendChild(Nodo3);
myTreeXML.appendChild(Nodo4);
myTreeXML.appendChild(Nodo5);
myTreeXML.appendChild(Nodo6);
// assegnazione dei figli
myTreeXML.firstChild.appendChild(Nodo10);
myTreeXML.firstChild.appendChild(Nodo11);
myTreeXML.firstChild.appendChild(Nodo12);
adesso i figli evidenziati me li dà tutti come figli di questo nodo
codice:
var Nodo1 = myTreeXML.createElement("node");
Nodo1.attributes.label = "TARGHE";
Nodo1.attributes.data = 0;
come faccio se volessi assegnarlo al nodo successivo??? :master:
Grazie