Skip to content

Commit 3224d02

Browse files
committed
Fix(grid): fix #3172 intermittent error when cellTemplatePromise not resolved
1 parent b98433f commit 3224d02

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/js/core/factories/Grid.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,8 @@ angular.module('ui.grid')
885885
*/
886886
Grid.prototype.preCompileCellTemplates = function() {
887887
var self = this;
888-
this.columns.forEach(function (col) {
888+
889+
var preCompileTemplate = function( col ) {
889890
var html = col.cellTemplate.replace(uiGridConstants.MODEL_COL_FIELD, self.getQualifiedColField(col));
890891
html = html.replace(uiGridConstants.COL_FIELD, 'grid.getCellValue(row, col)');
891892

@@ -906,6 +907,16 @@ angular.module('ui.grid')
906907
if (col.compiledElementFnDefer) {
907908
col.compiledElementFnDefer.resolve(col.compiledElementFn);
908909
}
910+
};
911+
912+
this.columns.forEach(function (col) {
913+
if ( col.cellTemplate ){
914+
preCompileTemplate( col );
915+
} else if ( col.cellTemplatePromise ){
916+
col.cellTemplatePromise.then( function() {
917+
preCompileTemplate( col );
918+
});
919+
}
909920
});
910921
};
911922

0 commit comments

Comments
 (0)