@@ -872,7 +872,7 @@ angular.module('apMesa.directives.apMesaExpandable', []).directive('apMesaExpand
872
872
scope . $watch ( 'row' , function ( ) {
873
873
var innerEl ;
874
874
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>' ) ;
876
876
} else if ( scope . options . expandableTemplate ) {
877
877
innerEl = angular . element ( scope . options . expandableTemplate ) ;
878
878
} else {
@@ -1016,19 +1016,19 @@ angular.module('apMesa.directives.apMesaRow', ['apMesa.directives.apMesaCell']).
1016
1016
scope . rowIsExpanded = ! ! scope . transientState . expandedRows [ index ] ;
1017
1017
scope . toggleRowExpand = function ( ) {
1018
1018
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 ) {
1019
1027
$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 ;
1026
1030
} ) ;
1027
1031
} ;
1028
- scope . refreshExpandedHeight = function ( ) {
1029
- var newHeight = element . next ( 'tr.ap-mesa-expand-panel' ) . height ( ) ;
1030
- scope . transientState . expandedRowHeights [ index ] = newHeight ;
1031
- } ;
1032
1032
scope . $watch ( 'transientState.expandedRows' , function ( nv , ov ) {
1033
1033
if ( nv !== ov ) {
1034
1034
scope . rowIsExpanded = false ;
0 commit comments