Skip to content

Commit 858b4af

Browse files
committed
Merge pull request #4343 from Namek/expandable_row_height---author-yccteam
Dynamically expanded row height
2 parents dc43dd9 + 9e2df5f commit 858b4af

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

src/features/expandable/js/expandable.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@
117117
* </pre>
118118
* @param {GridRow} row the row that was expanded
119119
*/
120+
rowExpandedBeforeStateChanged: function(scope,row){
121+
},
120122
rowExpandedStateChanged: function (scope, row) {
121123
}
122124
}
@@ -187,9 +189,15 @@
187189
},
188190

189191
toggleRowExpansion: function (grid, row) {
192+
// trigger the "before change" event. Can change row height dynamically this way.
193+
grid.api.expandable.raise.rowExpandedBeforeStateChanged(row);
190194
row.isExpanded = !row.isExpanded;
195+
if (angular.isUndefined(row.expandedRowHeight)){
196+
row.expandedRowHeight = grid.options.expandableRowHeight;
197+
}
198+
191199
if (row.isExpanded) {
192-
row.height = row.grid.options.rowHeight + grid.options.expandableRowHeight;
200+
row.height = row.grid.options.rowHeight + row.expandedRowHeight;
193201
}
194202
else {
195203
row.height = row.grid.options.rowHeight;

src/features/expandable/less/expandable.less

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212
}
1313

1414
}
15+
}
1516

1617

18+
.ui-grid-cell.ui-grid-disable-selection.ui-grid-row-header-cell{
19+
pointer-events: none;
20+
}
21+
.ui-grid-expandable-buttons-cell i{
22+
pointer-events: all;
1723
}
1824

1925
.scrollFiller {
2026
float:left;
2127
border:1px solid @borderColor;
2228
}
2329

24-
.ui-grid-expandable-buttons-cell { }

src/features/expandable/templates/expandableRow.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
ng-if="expandableRow.shouldRenderExpand()"
44
class="expandableRow"
55
style="float:left; margin-top: 1px; margin-bottom: 1px"
6-
ng-style="{width: (grid.renderContainers.body.getCanvasWidth()) + 'px', height: grid.options.expandableRowHeight + 'px'}">
6+
ng-style="{width: (grid.renderContainers.body.getCanvasWidth()) + 'px', height: row.expandedRowHeight + 'px'}">
77
</div>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div
22
ng-if="expandableRow.shouldRenderFiller()"
33
ng-class="{scrollFiller:true, scrollFillerClass:(colContainer.name === 'body')}"
4-
ng-style="{ width: (grid.getViewportWidth()) + 'px', height: grid.options.expandableRowHeight + 2 + 'px', 'margin-left': grid.options.rowHeader.rowHeaderWidth + 'px' }">
4+
ng-style="{ width: (grid.getViewportWidth()) + 'px', height: row.expandedRowHeight + 2 + 'px', 'margin-left': grid.options.rowHeader.rowHeaderWidth + 'px' }">
55
<i
66
class="ui-grid-icon-spin5 ui-grid-animate-spin"
7-
ng-style="{'margin-top': ( grid.options.expandableRowHeight/2 - 5) + 'px', 'margin-left' : ((grid.getViewportWidth() - grid.options.rowHeader.rowHeaderWidth)/2 - 5) + 'px'}">
7+
ng-style="{'margin-top': ( row.expandedRowHeight/2 - 5) + 'px', 'margin-left' : ((grid.getViewportWidth() - grid.options.rowHeader.rowHeaderWidth)/2 - 5) + 'px'}">
88
</i>
99
</div>

0 commit comments

Comments
 (0)