Skip to content

Commit ad0095e

Browse files
author
Nathan Koterba
committed
fix(core): Return promise from handleWindowResize method
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.
1 parent a9a3c0c commit ad0095e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/js/core/factories/Grid.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1503,14 +1503,15 @@ angular.module('ui.grid')
15031503
* @name handleWindowResize
15041504
* @methodOf ui.grid.class:Grid
15051505
* @description Triggered when the browser window resizes; automatically resizes the grid
1506+
* @returns {Promise} A resolved promise once the window resize has completed.
15061507
*/
15071508
Grid.prototype.handleWindowResize = function handleWindowResize($event) {
15081509
var self = this;
15091510

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

1513-
self.queueRefresh();
1514+
return self.queueRefresh();
15141515
};
15151516

15161517
/**

0 commit comments

Comments
 (0)