|
324 | 324 | compile: function () {
|
325 | 325 | return {
|
326 | 326 | pre: function ($scope, $elm, $attrs, uiGridCtrl) {
|
327 |
| - if ( uiGridCtrl.grid.options.enableExpandableRowHeader !== false ) { |
| 327 | + uiGridExpandableService.initializeGrid(uiGridCtrl.grid); |
| 328 | + |
| 329 | + if (!uiGridCtrl.grid.options.enableExpandable) { |
| 330 | + return; |
| 331 | + } |
| 332 | + |
| 333 | + if (uiGridCtrl.grid.options.enableExpandableRowHeader !== false ) { |
328 | 334 | var expandableRowHeaderColDef = {
|
329 | 335 | name: 'expandableButtons',
|
330 | 336 | displayName: '',
|
|
337 | 343 | expandableRowHeaderColDef.headerCellTemplate = $templateCache.get('ui-grid/expandableTopRowHeader');
|
338 | 344 | uiGridCtrl.grid.addRowHeaderColumn(expandableRowHeaderColDef);
|
339 | 345 | }
|
340 |
| - uiGridExpandableService.initializeGrid(uiGridCtrl.grid); |
| 346 | + |
341 | 347 | },
|
342 | 348 | post: function ($scope, $elm, $attrs, uiGridCtrl) {
|
343 | 349 | }
|
|
454 | 460 | return {
|
455 | 461 | pre: function ($scope, $elm, $attrs, controllers) {
|
456 | 462 |
|
| 463 | + if (!$scope.grid.options.enableExpandable) { |
| 464 | + return; |
| 465 | + } |
| 466 | + |
457 | 467 | $scope.expandableRow = {};
|
458 | 468 |
|
459 | 469 | $scope.expandableRow.shouldRenderExpand = function () {
|
|
512 | 522 | priority: -200,
|
513 | 523 | scope: false,
|
514 | 524 | compile: function ($elm, $attrs) {
|
| 525 | + |
| 526 | + //todo: this adds ng-if watchers to each row even if the grid is not using expandable directive |
| 527 | + // or options.enableExpandable == false |
| 528 | + // The alternative is to compile the template and append to each row in a uiGridRow directive |
| 529 | + |
515 | 530 | var rowRepeatDiv = angular.element($elm.children().children()[0]);
|
516 | 531 | var expandedRowFillerElement = $templateCache.get('ui-grid/expandableScrollFiller');
|
517 | 532 | var expandedRowElement = $templateCache.get('ui-grid/expandableRow');
|
|
0 commit comments