From affff77889b0fec8da23407aff56b4d97e442f7a Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 18 Nov 2010 23:39:18 -0500 Subject: [PATCH] Fix defering the insertEvents call when there are more than 2 calendars. --- kronolith/js/mobile.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kronolith/js/mobile.js b/kronolith/js/mobile.js index 98a634e17..dc1c0990c 100644 --- a/kronolith/js/mobile.js +++ b/kronolith/js/mobile.js @@ -144,8 +144,8 @@ dates = [start, end], view = data.response.view, list, events; data = data.response; - KronolithMobile.loadedCalendars.push(data.cal); KronolithMobile.storeCache(data.events, data.cal, dates, true); + KronolithMobile.loadedCalendars.push(data.cal); KronolithMobile.insertEvents(dates, view, data.cal); }, @@ -164,6 +164,9 @@ if (KronolithMobile.loadedCalendars.length != KronolithMobile.calendars.length || KronolithMobile.view != view) { + if (KronolithMobile.timeoutId) { + window.clearTimeout(KronolithMobile.timeoutId); + } KronolithMobile.timeoutId = window.setTimeout(function() {KronolithMobile.insertEvents(dates, view);}, 0); return; } @@ -174,7 +177,6 @@ } date = dates[0].clone(); events = KronolithMobile.getCacheForDate(date.dateString()); - events = KronolithMobile.sortEvents(events); list = $('