summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-08 14:25:41 +0200
committerAleksander Machniak <alec@alec.pl>2013-05-08 14:25:41 +0200
commitea6d6958e0a32c88bf8c00cbd118cfcd48fae096 (patch)
tree2027f6ca07ab2d679dc71e40ea414f990b0e9038 /program/js
parent259d37be3e992e06a899b82a0d60bef2148f82b4 (diff)
Allow row insertion at a specified position (not only on top of the list)
Diffstat (limited to 'program/js')
-rw-r--r--program/js/list.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/program/js/list.js b/program/js/list.js
index c6b0d3fb8..e689c6722 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -199,12 +199,12 @@ remove_row: function(uid, sel_next)
/**
* Add row to the list and initialize it
*/
-insert_row: function(row, attop)
+insert_row: function(row, before)
{
var tbody = this.list.tBodies[0];
- if (attop && tbody.rows.length)
- tbody.insertBefore(row, tbody.firstChild);
+ if (before && tbody.rows.length)
+ tbody.insertBefore(row, (typeof before == 'object' && before.parentNode == tbody) ? before : tbody.firstChild);
else
tbody.appendChild(row);