Created
November 3, 2016 14:35
-
-
Save juannorris/f9d6631e78fa1f48a59d4cdd9842a5e7 to your computer and use it in GitHub Desktop.
Override Gantt functionality to update visible headers, columns and tasks on horizontal scroll.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Workaround for gantt tooltips not showing when gantt-scrollable has horizontal scroll and its parent has an animation. | |
*/ | |
.gantt-task-info { | |
-webkit-animation-fill-mode: both; | |
animation-fill-mode: both; | |
-webkit-animation-duration: 0s; | |
animation-duration: 0s; | |
-webkit-animation-name: fadeIn; | |
animation-name: fadeIn; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (angular) { | |
/** | |
* Override Gantt functionality to update visible headers, columns and tasks on horizontal scroll. | |
*/ | |
function GanttColumnsManagerDecorator($delegate) { | |
$delegate.prototype.updateVisibleColumns = function (includeViews) { | |
this.visibleColumns = this.columns; | |
this.visibleHeaders = []; | |
for (var i = 0; i < this.headers.length; i++) { | |
this.visibleHeaders.push(this.headers[i]); | |
} | |
if (includeViews) { | |
for (i = 0; i < this.visibleColumns.length; i++) { | |
this.visibleColumns[i].updateView(); | |
} | |
for (i = 0; i < this.visibleHeaders.length; i++) { | |
var headerRow = this.visibleHeaders[i]; | |
for (var j = 0; j < headerRow.length; j++) { | |
headerRow[j].updateView(); | |
} | |
} | |
} | |
var currentDateValue = this.gantt.options.value('currentDateValue'); | |
this.gantt.currentDateManager.setCurrentDate(currentDateValue); | |
}; | |
return $delegate; | |
} | |
function GanttRowDecorator($delegate, $filter) { | |
$delegate.prototype.updateVisibleTasks = function () { | |
var filterTask = this.rowsManager.gantt.options.value('filterTask'); | |
if (filterTask) { | |
if (typeof(filterTask) === 'object') { | |
filterTask = {model: filterTask}; | |
} | |
var filterTaskComparator = this.rowsManager.gantt.options.value('filterTaskComparator'); | |
if (typeof(filterTaskComparator) === 'function') { | |
filterTaskComparator = function (actual, expected) { | |
return filterTaskComparator(actual.model, expected.model); | |
}; | |
} | |
this.filteredTasks = $filter('filter')(this.tasks, filterTask, filterTaskComparator); | |
} else { | |
this.filteredTasks = this.tasks.slice(0); | |
} | |
this.visibleTasks = this.filteredTasks; | |
}; | |
return $delegate; | |
} | |
GanttColumnsManagerDecorator.$inject = ['$delegate']; | |
GanttRowDecorator.$inject = ['$delegate', '$filter']; | |
angular.module('gantt') | |
.decorator('GanttColumnsManager', GanttColumnsManagerDecorator) | |
.decorator('GanttRow', GanttRowDecorator); | |
})(angular); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment