diff --git a/calendar/js/View.ts b/calendar/js/View.ts index 5e8d4a56a0..89da50f8cc 100644 --- a/calendar/js/View.ts +++ b/calendar/js/View.ts @@ -132,9 +132,35 @@ export abstract class View parseInt(egw.preference('interval', 'calendar')) || 30; } - public static extend(sub) + /** + * You can't iterate through a class's methods normally and get parent methods as well. + * This lets us get the methods from class + parent + * + * @param view + * @returns {string[]} + */ + public static getAllFuncs(view) { - return jQuery.extend({}, this, {_super: this}, sub); + const props = []; + let obj = view; + do + { + props.push(...Object.getOwnPropertyNames(obj)); + } + while((obj = Object.getPrototypeOf(obj)) && obj !== View); + props.push(...Object.getOwnPropertyNames(View)); + + return props.sort().filter((e, i, arr) => + { + if(e[0] === "_" || ["getAllFuncs"].indexOf(e) !== -1) + { + return false; + } + if(e != arr[i + 1] && typeof view[e] == 'function') + { + return true; + } + }); } /** diff --git a/calendar/js/app.ts b/calendar/js/app.ts index ce806f6df7..b11e8e189c 100644 --- a/calendar/js/app.ts +++ b/calendar/js/app.ts @@ -3106,7 +3106,7 @@ export class CalendarApp extends EgwApp { // Simple, easy case - just one widget for the selected time span. (planner) // Update existing view's special attribute filters, defined in the view list - for(let updater of Object.getOwnPropertyNames(view)) + for(let updater of view.getAllFuncs(view)) { if(typeof view[updater] === 'function') { diff --git a/calendar/js/et2_widget_planner.ts b/calendar/js/et2_widget_planner.ts index 938f400436..1115cd16e8 100644 --- a/calendar/js/et2_widget_planner.ts +++ b/calendar/js/et2_widget_planner.ts @@ -1008,7 +1008,7 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta // Adjust header if there's a scrollbar if(this.rows.children().last().length) { - this.gridHeader.css('margin-right', (this.rows.width() - this.rows.children().last().width()) + 'px'); + this.gridHeader.css('margin-right', (this.rows.width() - this.rows.children().first().width()) + 'px'); } // Add actual events for(var key in this._deferred_row_updates) @@ -2034,7 +2034,7 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta // in some cases if(this.rows.children().last().length) { - this.gridHeader.css('margin-right', (this.rows.width() - this.rows.children().last().width()) + 'px'); + this.gridHeader.css('margin-right', (this.rows.width() - this.rows.children().first().width()) + 'px'); } }