From: Jan Schneider Date: Sun, 7 Jun 2009 15:48:36 +0000 (+0200) Subject: Sort new agenda day into the table. Necessary for searches where events don't X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=36a66881d5d1a458a8bfc31fdf0b19d061c7a7fb;p=horde.git Sort new agenda day into the table. Necessary for searches where events don't arrive in chronological order. --- diff --git a/kronolith/js/src/kronolith.js b/kronolith/js/src/kronolith.js index 52d6f0896..03de7e29f 100644 --- a/kronolith/js/src/kronolith.js +++ b/kronolith/js/src/kronolith.js @@ -498,11 +498,23 @@ KronolithCore = { row.addClassName('kronolithRow' + (body.select('tr').length % 2 == 1 ? 'Odd' : 'Even')) .down() .setText(this.parseDate(date).toString('D')) + .writeAttribute('date', date) .next() .writeAttribute('id', 'kronolithAgendaDay' + date); // Insert row. - body.insert(row.show()); + var nextRow; + body.childElements().each(function(elm) { + if (elm.down().readAttribute('date') > date) { + nextRow = elm; + return; + } + }); + if (nextRow) { + nextRow.insert({ 'before': row.show() }); + } else { + body.insert(row.show()); + } return row; },