summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-20 22:40:49 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-20 22:40:49 +0100
commit74a99c8b40af27786745800b0e98943f66fffa35 (patch)
treed521efbed59a8f75d31c49a1c62a2cd5988c23d2
parentb50a1ba738f842e4e1f716c54c9f58ec3e089bd1 (diff)
JavaScript: Append new student score rows as appropriate.
-rw-r--r--logikorr.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/logikorr.js b/logikorr.js
index cf082d3..87ca4b1 100644
--- a/logikorr.js
+++ b/logikorr.js
@@ -27,6 +27,8 @@ YUI().use('node-base', 'io-base', 'io-form', 'io-queue', 'json', function (Y) {
Y.log(nameInput);
Y.log(scoreCell);
function doUpdate(id, o, args) {
+ ensureFreeStudentRow();
+
var data = o.responseText;
try {
var student = Y.JSON.parse(data);
@@ -69,6 +71,19 @@ YUI().use('node-base', 'io-base', 'io-form', 'io-queue', 'json', function (Y) {
makeScoreInput(cell);
Y.on("blur", updateStudentRowFromName, input, Y, input, cell);
+
+ return row;
+ };
+
+ function ensureFreeStudentRow() {
+ var table = document.getElementById('ergebnisse')
+ var num = table.rows.length;
+ var input = table.rows[num - 1].cells[0].firstChild;
+ if (!(input.value == undefined || input.value == "")) {
+ return makeStudentRow();
+ } else {
+ return table.lastChild;
+ }
};
return Y.on('domready', makeStudentRow);