From 3398c97055943deed397d0ecd9cb9c8257466021 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 15 May 2023 10:14:22 -0600 Subject: [PATCH] Calendar: Fix different template load order could result in missing categories and extra loading --- calendar/js/et2_widget_planner.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/calendar/js/et2_widget_planner.ts b/calendar/js/et2_widget_planner.ts index b65a9426b6..0b8a2d1970 100644 --- a/calendar/js/et2_widget_planner.ts +++ b/calendar/js/et2_widget_planner.ts @@ -722,10 +722,22 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta row_labels: function() { var im = this.getInstanceManager(); - this.nodeName = "ET2-SELECT-CAT_RO" - var categories = StaticOptions.cached_server_side(this, "cat", ',,,calendar', false); - var labels = []; + var categories = StaticOptions.cached_server_side(this, "cat", ',,,calendar', false); + if(!categories || categories.length == 0) + { + // No categories at all? Probably loading before sidebox is done. Ask directly and wait for them, rather than firing + // 50 different requests. + egw.json( + 'EGroupware\\Api\\Etemplate\\Widget\\Select::ajax_get_options', + ['select-cat', ',,,calendar'], + function(data) + { + categories = data; + } + ).sendRequest(false); + } + let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar; if(!app_calendar.state.cat_id || app_calendar.state.cat_id.toString() === '' ||