From ea6d6958e0a32c88bf8c00cbd118cfcd48fae096 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Wed, 08 May 2013 08:25:41 -0400 Subject: [PATCH] Allow row insertion at a specified position (not only on top of the list) --- program/js/list.js | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/program/js/list.js b/program/js/list.js index c6b0d3f..e689c67 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -199,12 +199,12 @@ /** * 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); -- Gitblit v1.9.1