Permalink
Browse files

[IMP] web: Avoid scroll in calendar in mobile

  • Loading branch information...
jat-odoo committed Feb 4, 2019
1 parent 1076c70 commit f4266034530757505425b725a41c1008bd3c27d4
Showing with 14 additions and 7 deletions.
  1. +14 −7 addons/web/static/src/js/views/calendar/calendar_renderer.js
@@ -201,6 +201,20 @@ return AbstractRenderer.extend({
}
return this._super();
},
/**
* @override
*/
on_attach_callback: function () {
if (config.device.isMobile) {
this.$el.height($(window).height() - this.$el.offset().top);
}
var scrollTop = this.$calendar.find('.fc-scroller').scrollTop();
if (scrollTop) {
this.$calendar.fullCalendar('reinitView');
} else {
this.$calendar.fullCalendar('render');
}
},
/**
* @override
*/
@@ -504,7 +518,6 @@ return AbstractRenderer.extend({
var $calendar = this.$calendar;
var $fc_view = $calendar.find('.fc-view');
var scrollPosition = $fc_view.scrollLeft();
var scrollTop = this.$calendar.find('.fc-scroller').scrollTop();

$fc_view.scrollLeft(0);
$calendar.fullCalendar('unselect');
@@ -536,12 +549,6 @@ return AbstractRenderer.extend({

this._unselectEvents();
this._renderFilters();
this.$calendar.appendTo('body');
if (scrollTop) {
this.$calendar.fullCalendar('reinitView');
} else {
this.$calendar.fullCalendar('render');
}
this._renderEvents();
this.$calendar.prependTo(this.$('.o_calendar_view'));

0 comments on commit f426603

Please sign in to comment.