Hallo zusammen,
ich habe Variablen die ich in ein Array ablegen möchte und danach in einer HTML-Tabelle anzeigen will.
Mein Problem ist, dass alle Elemente gefunden werden aber mit push nicht wie erwartet drei Zeilen ausgegeben werden sondern nur eine. Jedes Element überschreibt die Array[2]-Zeile. Ich weiß aber nicht was ich falsch mache.
So das Script:
foundAnz = -1;
foundPos = -1;
for (zaehlerAuftr = 0; (zaehlerAuftr < aufAnzahl) && (foundAnz == -1); zaehlerAuftr++) {
//hier zählt er richtig die Elementanzahl
if (auftragsnr[zaehlerAuftr] == ExNumin) {
foundAnz = 1;
foundPos = zaehlerAuftr;
}
}
if (foundAnz == -1) {
auftragsnr[aufAnzahl] = ExNumin;
aufAnzahl++;
//hier ist die foundPos immer die Anzahl der Elemente
foundPos = zaehlerAuftr;
b_bestand[foundPos] = new Array(ExNumin, ExNomEta, ExPlz, ExOrt, ExGebiet, lastLief, datum_array[0][1], durchQte, durchRytmus, nextLief, anzLief, warning );
}
else {
b_bestand[foundPos][0] = ExNumin;
b_bestand[foundPos][1] = ExNomEta;
b_bestand[foundPos][2] = ExPlz;
b_bestand[foundPos][3] = ExOrt;
b_bestand[foundPos][4] = ExGebiet;
b_bestand[foundPos][5] = lastLief;
b_bestand[foundPos][6] = datum_array[0][1];
b_bestand[foundPos][7] = durchQte;
b_bestand[foundPos][8] = durchRytmus;
b_bestand[foundPos][9] = nextLief;
b_bestand[foundPos][10] = anzLief;
b_bestand[foundPos][11] = warning;
}
//und hier wird nun jedes tr-Array beim foundPos überschrieben.
tr.push("<tr class='text10'><td>"+ b_bestand[foundPos][1] +"</td><td>"+ b_bestand[foundPos][2] +"</td><td>"+ b_bestand[foundPos][3] +"</td><td>"+ b_bestand[foundPos][4] +"</td><td>"+ b_bestand[foundPos][5] +"</td><td>"+ b_bestand[foundPos][6] +"</td><td>"+ b_bestand[foundPos][7] +"</td><td>"+ b_bestand[foundPos][8] +"</td><td>"+ b_bestand[foundPos][9] +"</td><td>"+ b_bestand[foundPos][10] +"</td><td>"+ b_bestand[foundPos][11] +"</td></tr>");
//also er zählt nicht von 0-Anzahl der Elemente
Was mach ich falsch ich verzweifle noch. Die Variablen kommen aus einer DB.
Viele Grüße
Stefan