Skip to content

Commit

Permalink
fix(core): Return promise from handleWindowResize method
Browse files Browse the repository at this point in the history
Current documentation says Grid.prototype.handleWindowResize returns a Promise (https://github.com/angular-ui/ui-grid/blob/fe00489/src/js/core/factories/Grid.js#L263) but in fact the internal Grid.prototype.handleWindowResize method was never returning the Grid.prototype.queueRefresh promise (https://github.com/angular-ui/ui-grid/blob/fe00489/src/js/core/factories/Grid.js#L1513). This fix allows ui-grid users to wait until the grid is correctly sized before performing certain actions (like scrolling) which require an accurately-sized grid.
  • Loading branch information
Nathan Koterba committed Oct 13, 2015
1 parent a9a3c0c commit ad0095e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js/core/factories/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -1503,14 +1503,15 @@ angular.module('ui.grid')
* @name handleWindowResize
* @methodOf ui.grid.class:Grid
* @description Triggered when the browser window resizes; automatically resizes the grid
* @returns {Promise} A resolved promise once the window resize has completed.
*/
Grid.prototype.handleWindowResize = function handleWindowResize($event) {
var self = this;

self.gridWidth = gridUtil.elementWidth(self.element);
self.gridHeight = gridUtil.elementHeight(self.element);

self.queueRefresh();
return self.queueRefresh();
};

/**
Expand Down

0 comments on commit ad0095e

Please sign in to comment.