From 61286c3cecf46abfde425c6bfa18f61343f68867 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sun, 14 Nov 2010 18:56:45 -0500 Subject: [PATCH] first stab at sorting events before building day view --- kronolith/js/kronolithmobile.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kronolith/js/kronolithmobile.js b/kronolith/js/kronolithmobile.js index d54b436a1..3d02747ab 100644 --- a/kronolith/js/kronolithmobile.js +++ b/kronolith/js/kronolithmobile.js @@ -43,6 +43,15 @@ } }, + sortEvents: function(events) + { + return events.sort(function(a, b) { + sortA = a.e.s; + sortB = b.e.s; + return (sortA < sortB) ? -1 : (sortA > sortB) ? 1 : 0; + }); + }, + /** * Callback for the listEvents AJAX request. */ @@ -60,8 +69,9 @@ }); } if (KronolithMobile.loadedCalendars.length == KronolithMobile.calendars.length) { + var events = KronolithMobile.sortEvents(KronolithMobile.events); list = $('