@@ -595,10 +595,10 @@ angular.module('ui.grid')
595
595
callback . types . indexOf ( type ) !== - 1 ||
596
596
type === uiGridConstants . dataChange . ALL ) {
597
597
if ( callback . _this ) {
598
- callback . callback . apply ( callback . _this , this ) ;
598
+ callback . callback . apply ( callback . _this , this , options ) ;
599
599
}
600
600
else {
601
- callback . callback ( this ) ;
601
+ callback . callback ( this , options ) ;
602
602
}
603
603
}
604
604
} , this ) ;
@@ -636,10 +636,11 @@ angular.module('ui.grid')
636
636
* is notified, which triggers handling of the visible flag.
637
637
* This is called on uiGridConstants.dataChange.COLUMN, and is
638
638
* registered as a dataChangeCallback in grid.js
639
- * @param {string } name column name
639
+ * @param {object } grid The grid object.
640
+ * @param {object } options Any options passed into the callback.
640
641
*/
641
- Grid . prototype . columnRefreshCallback = function columnRefreshCallback ( grid ) {
642
- grid . buildColumns ( ) ;
642
+ Grid . prototype . columnRefreshCallback = function columnRefreshCallback ( grid , options ) {
643
+ grid . buildColumns ( options ) ;
643
644
grid . queueGridRefresh ( ) ;
644
645
} ;
645
646
@@ -757,9 +758,12 @@ angular.module('ui.grid')
757
758
* @name addRowHeaderColumn
758
759
* @methodOf ui.grid.class:Grid
759
760
* @description adds a row header column to the grid
760
- * @param {object } column def
761
+ * @param {object } colDef Column definition object.
762
+ * @param {float } order Number that indicates where the column should be placed in the grid.
763
+ * @param {boolean } stopColumnBuild Prevents the buildColumn callback from being triggered. This is useful to improve
764
+ * performance of the grid during initial load.
761
765
*/
762
- Grid . prototype . addRowHeaderColumn = function addRowHeaderColumn ( colDef , order ) {
766
+ Grid . prototype . addRowHeaderColumn = function addRowHeaderColumn ( colDef , order , stopColumnBuild ) {
763
767
var self = this ;
764
768
765
769
//default order
@@ -791,11 +795,13 @@ angular.module('ui.grid')
791
795
return a . headerPriority - b . headerPriority ;
792
796
} ) ;
793
797
794
- self . buildColumns ( )
795
- . then ( function ( ) {
796
- self . preCompileCellTemplates ( ) ;
797
- self . queueGridRefresh ( ) ;
798
- } ) . catch ( angular . noop ) ;
798
+ if ( ! stopColumnBuild ) {
799
+ self . buildColumns ( )
800
+ . then ( function ( ) {
801
+ self . preCompileCellTemplates ( ) ;
802
+ self . queueGridRefresh ( ) ;
803
+ } ) . catch ( angular . noop ) ;
804
+ }
799
805
} ) . catch ( angular . noop ) ;
800
806
} ;
801
807
@@ -913,6 +919,9 @@ angular.module('ui.grid')
913
919
if ( self . rows . length > 0 ) {
914
920
self . assignTypes ( ) ;
915
921
}
922
+ if ( options . preCompileCellTemplates ) {
923
+ self . preCompileCellTemplates ( ) ;
924
+ }
916
925
} ) . catch ( angular . noop ) ;
917
926
} ;
918
927
@@ -1617,12 +1626,11 @@ angular.module('ui.grid')
1617
1626
* @methodOf ui.grid.class:Grid
1618
1627
* @description calls each styleComputation function
1619
1628
*/
1620
- // TODO: this used to take $scope, but couldn't see that it was used
1621
1629
Grid . prototype . buildStyles = function buildStyles ( ) {
1622
- // gridUtil.logDebug('buildStyles');
1623
-
1624
1630
var self = this ;
1625
1631
1632
+ // gridUtil.logDebug('buildStyles');
1633
+
1626
1634
self . customStyles = '' ;
1627
1635
1628
1636
self . styleComputations
@@ -2114,9 +2122,7 @@ angular.module('ui.grid')
2114
2122
Grid . prototype . refreshCanvas = function ( buildStyles ) {
2115
2123
var self = this ;
2116
2124
2117
- if ( buildStyles ) {
2118
- self . buildStyles ( ) ;
2119
- }
2125
+ // gridUtil.logDebug('refreshCanvas');
2120
2126
2121
2127
var p = $q . defer ( ) ;
2122
2128
@@ -2140,6 +2146,11 @@ angular.module('ui.grid')
2140
2146
}
2141
2147
}
2142
2148
2149
+ // Build the styles without the explicit header heights
2150
+ if ( buildStyles ) {
2151
+ self . buildStyles ( ) ;
2152
+ }
2153
+
2143
2154
/*
2144
2155
*
2145
2156
* Here we loop through the headers, measuring each element as well as any header "canvas" it has within it.
@@ -2153,11 +2164,6 @@ angular.module('ui.grid')
2153
2164
*
2154
2165
*/
2155
2166
if ( containerHeadersToRecalc . length > 0 ) {
2156
- // Build the styles without the explicit header heights
2157
- if ( buildStyles ) {
2158
- self . buildStyles ( ) ;
2159
- }
2160
-
2161
2167
// Putting in a timeout as it's not calculating after the grid element is rendered and filled out
2162
2168
$timeout ( function ( ) {
2163
2169
// var oldHeaderHeight = self.grid.headerHeight;
0 commit comments