From c42795cc9e2fd7bf7517bf19a1e8f6d72619e48a Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 10 Feb 2021 13:10:28 -0700 Subject: [PATCH] Calendar: Fix events that were updated while calendar was not the active tab were misplaced at the beginning of the day --- calendar/js/et2_widget_daycol.js | 8 ++++++++ calendar/js/et2_widget_daycol.ts | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/calendar/js/et2_widget_daycol.js b/calendar/js/et2_widget_daycol.js index 46542a0731..169d4ad5d9 100644 --- a/calendar/js/et2_widget_daycol.js +++ b/calendar/js/et2_widget_daycol.js @@ -308,6 +308,14 @@ var et2_calendar_daycol = /** @class */ (function (_super) { event_ids.splice(i--, 1); } } + if (!this.div.is(":visible")) { + // Not visible, defer the layout or it all winds up at the top + // Cancel any existing listener & bind + jQuery(this.getInstanceManager().DOMContainer.parentNode) + .off('show.et2_daycol' + this.id) + .one('show.et2_daycol' + this.id, function () { this._update_events(events); }.bind(this)); + return; + } if (!this.getParent().disabled) this._update_events(events); }; diff --git a/calendar/js/et2_widget_daycol.ts b/calendar/js/et2_widget_daycol.ts index 8bb0576a01..ad9cef65ff 100644 --- a/calendar/js/et2_widget_daycol.ts +++ b/calendar/js/et2_widget_daycol.ts @@ -404,6 +404,16 @@ export class et2_calendar_daycol extends et2_valueWidget implements et2_IDetache event_ids.splice(i--,1); } } + + if(!this.div.is(":visible")) + { + // Not visible, defer the layout or it all winds up at the top + // Cancel any existing listener & bind + jQuery(this.getInstanceManager().DOMContainer.parentNode) + .off('show.et2_daycol'+this.id) + .one('show.et2_daycol'+this.id, function() {this._update_events(events)}.bind(this)); + return; + } if(!this.getParent().disabled) this._update_events(events); }