Added fix for the sticky table headers when horizontally scrolling the calendar view.

This commit is contained in:
Alex Tselegidis 2016-08-15 21:59:43 +02:00
parent 5bb56b8653
commit d4360bef80
1 changed files with 17 additions and 1 deletions

View File

@ -22,6 +22,13 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
'use strict'; 'use strict';
/**
* Sticky Table Header Fix
*
* @type {Number}
*/
var stickyTableHeaderInterval;
/** /**
* Bind page event handlers. * Bind page event handlers.
*/ */
@ -47,6 +54,15 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
var startDate = new Date($('.calendar-view .date-column:first').data('date')); var startDate = new Date($('.calendar-view .date-column:first').data('date'));
var endDate = new Date(startDate.getTime()).add({days: parseInt($(this).val()) - 1}); var endDate = new Date(startDate.getTime()).add({days: parseInt($(this).val()) - 1});
_createView(startDate, endDate); _createView(startDate, endDate);
// Horizontal scrolling fix for sticky table headers.
if ($(this).val() === 1) {
clearInterval(stickyTableHeaderInterval);
} else {
stickyTableHeaderInterval = setInterval(function() {
$(window).trigger('resize.stickyTableHeaders');
}, 1000);
}
}); });
$calendarToolbar.on('click', '#reload-appointments', function() { $calendarToolbar.on('click', '#reload-appointments', function() {
@ -860,7 +876,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
$('#enable-sync, #google-sync').hide(); $('#enable-sync, #google-sync').hide();
// Auto-reload the results every one minute. // Auto-reload the results every one minute.
var interval = setInterval(function() { setInterval(function() {
$('#reload-appointments').trigger('click'); $('#reload-appointments').trigger('click');
}, 20000); }, 20000);
}; };