1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
function readData(oData) {
//Suppression des lignes
var tabl= document.getElementById("tableau");
var nbLignes= document.getElementById("tableau").rows.length;
var nbcol = get_nbcol();
for(i=1;i<=nbcol;i++){
$('.colonne'+i).remove();
}
$('th.vertical').remove();
for(i=0;i<nbLignes;i++){
$('.jour'+i).remove();
}
// création de la nouvelle ligne
var nodes_jour = oData.getElementsByTagName("jour");
// var nbcol= oData.getElementsByTagName("NBCOL");
// var nbcol2= nbcol.getAttribute("value");
var nbcol= oData.getElementsByTagName("NBCOL")[0];
var bouga = parseInt(nbcol);
alert(bouga);
// alert("FDMLKFPOERD");
for(i=0;i<nodes_jour.length;i++){
var row = document.createElement("tr");
var entete_jour = document.createElement("td");
entete_jour.setAttribute("class","jour"+i);
entete_jour.setAttribute("id","jour");
var jour = document.createTextNode(nodes_jour[i].getAttribute("name"));
entete_jour.appendChild(jour);
row.appendChild(entete_jour);
for(j=0;j<parseInt(nbcol);j++){
var cell = document.createElement("td");
cell.setAttribute("class","colonne"+j);
row.appendChild(cell);
}
tabl.appendChild(row);
}
// création de la nouvelle colonne
var nodes_lot = oData.getElementsByTagName("LOT");
var row_entete = document.getElementById("row_entete");
for(i=0;i<nodes_lot.length;i++){
var textcol = document.createTextNode(nodes_lot[i].getAttribute("name"));
var col = document.createElement("th");
col.setAttribute("class","vertical");
col.style.backgroundColor="#046380";
var divcol= document.createElement("div");
divcol.setAttribute("class","vertical");
divcol.appendChild(textcol);
col.appendChild(divcol);
row_entete.appendChild(col);
var nodes_activite= nodes_lot[i].getElementsByTagName("activite");
for(j=0;j<nodes_activite.length;j++){
var textcol2 = document.createTextNode(nodes_activite[j].getAttribute("name"));
var col2 = document.createElement("th");
col2.setAttribute("class","vertical");
var divcol2= document.createElement("div");
divcol2.setAttribute("class","vertical");
divcol2.appendChild(textcol2);
col2.appendChild(divcol2);
row_entete.appendChild(col2);
}
}
} |