diff --git a/src/os/ui/slick/slickgrid.js b/src/os/ui/slick/slickgrid.js index 0e44b1541..fd9b1c956 100644 --- a/src/os/ui/slick/slickgrid.js +++ b/src/os/ui/slick/slickgrid.js @@ -19,6 +19,7 @@ goog.require('os.events'); goog.require('os.string'); goog.require('os.ui'); goog.require('os.ui.Module'); +goog.require('os.ui.ResizeEventType'); goog.require('os.ui.column.columnManagerDirective'); goog.require('os.ui.globalMenuDirective'); goog.require('os.ui.menu.IMenuSupplier'); @@ -253,6 +254,7 @@ os.ui.slick.SlickGridCtrl = function($scope, $element, $compile) { $scope.$on(os.ui.slick.SlickGridEvent.SCROLL_TO_CELL, this.onScrollToCell.bind(this)); $scope.$on(os.ui.slick.SlickGridEvent.SORT_SELECTED, this.onSortBySelectionChange.bind(this)); $scope.$on('resize', this.resizeFn); + $scope.$on(os.ui.ResizeEventType.UPDATE_RESIZE, this.onUpdateResize.bind(this)); $scope['cellTooltips'] = $scope['cellTooltips'] == undefined ? true : $scope['cellTooltips']; @@ -646,6 +648,17 @@ os.ui.slick.SlickGridCtrl.prototype.doResize = function() { }; +/** + * Handler for updating the resize listener. This is needed due to cases where the resize listener breaks. + * @private + */ +os.ui.slick.SlickGridCtrl.prototype.onUpdateResize = function() { + os.ui.removeResize(this.element, this.resizeFn); + os.ui.resize(this.element, this.resizeFn); +}; + + + /** * Copys rows in the grid. * diff --git a/src/os/ui/ui.js b/src/os/ui/ui.js index 54610573a..91f953e45 100644 --- a/src/os/ui/ui.js +++ b/src/os/ui/ui.js @@ -1,5 +1,6 @@ goog.provide('os.ui'); goog.provide('os.ui.Module'); +goog.provide('os.ui.ResizeEventType'); goog.require('goog.events.EventTarget'); goog.require('goog.html.SafeHtml'); @@ -286,6 +287,15 @@ os.ui.removeResize = function(el, fn) { }; +/** + * Enumeration of resize event types. + * @enum {string} + */ +os.ui.ResizeEventType = { + UPDATE_RESIZE: 'updateResize' +}; + + /** * Replace a directive already registered with Angular. The directive name and module should be identical to the * original.