Skip to content

Commit b657031

Browse files
author
Andrew Perlitch
committed
another tweak to ensure correct expanded row height calc
1 parent 9f1a6bb commit b657031

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

dist/ap-mesa.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ angular.module('apMesa.directives.apMesaExpandable', []).directive('apMesaExpand
872872
scope.$watch('row', function () {
873873
var innerEl;
874874
if (scope.options.expandableTemplateUrl) {
875-
innerEl = angular.element('<div ng-include="options.expandableTemplateUrl"></div>');
875+
innerEl = angular.element('<div ng-include="options.expandableTemplateUrl" onload="refreshExpandedHeight(true)"></div>');
876876
} else if (scope.options.expandableTemplate) {
877877
innerEl = angular.element(scope.options.expandableTemplate);
878878
} else {
@@ -1016,19 +1016,19 @@ angular.module('apMesa.directives.apMesaRow', ['apMesa.directives.apMesaCell']).
10161016
scope.rowIsExpanded = !!scope.transientState.expandedRows[index];
10171017
scope.toggleRowExpand = function () {
10181018
scope.transientState.expandedRows[index] = scope.rowIsExpanded = !scope.transientState.expandedRows[index];
1019+
if (!scope.transientState.expandedRows[index]) {
1020+
delete scope.transientState.expandedRows[index];
1021+
delete scope.transientState.expandedRowHeights[index];
1022+
} else {
1023+
scope.refreshExpandedHeight(false);
1024+
}
1025+
};
1026+
scope.refreshExpandedHeight = function (fromTemplate) {
10191027
$timeout(function () {
1020-
if (!scope.transientState.expandedRows[index]) {
1021-
delete scope.transientState.expandedRows[index];
1022-
delete scope.transientState.expandedRowHeights[index];
1023-
} else {
1024-
scope.refreshExpandedHeight();
1025-
}
1028+
var newHeight = element.next('tr.ap-mesa-expand-panel').height();
1029+
scope.transientState.expandedRowHeights[index] = newHeight;
10261030
});
10271031
};
1028-
scope.refreshExpandedHeight = function () {
1029-
var newHeight = element.next('tr.ap-mesa-expand-panel').height();
1030-
scope.transientState.expandedRowHeights[index] = newHeight;
1031-
};
10321032
scope.$watch('transientState.expandedRows', function (nv, ov) {
10331033
if (nv !== ov) {
10341034
scope.rowIsExpanded = false;

0 commit comments

Comments
 (0)