Skip to content

Commit b75d797

Browse files
MKirovaMKirova
authored andcommitted
fix(IgxGrid): Add summary rows to special record types to skip for merge.
1 parent 641768d commit b75d797

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

projects/igniteui-angular/src/lib/data-operations/merge-strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class DefaultMergeStrategy implements IGridMergeStrategy {
6767

6868
const recData = result[index];
6969
// if this is active row or some special record type - add and skip merging
70-
if (activeRowIndexes.indexOf(index) != -1 || (grid && grid.isDetailRecord(rec) || grid.isGroupByRecord(rec) || grid.isChildGridRecord(rec))) {
70+
if (activeRowIndexes.indexOf(index) != -1 || (grid && grid.isDetailRecord(rec) || grid.isGroupByRecord(rec) || grid.isChildGridRecord(rec) || grid.isSummaryRow(rec))) {
7171
if (!recData) {
7272
result.push(rec);
7373
}

projects/igniteui-angular/src/lib/grids/grid/cell-merge.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,27 @@ describe('IgxGrid - Cell merging #grid', () => {
301301

302302
});
303303

304+
describe('Summaries', () => {
305+
it('should merge correctly when summary row is shown.', () => {
306+
grid.groupBy({
307+
fieldName: 'ProductName', dir: SortingDirection.Desc,
308+
ignoreCase: false, strategy: DefaultSortingStrategy.instance()
309+
});
310+
fix.detectChanges();
311+
312+
const col = grid.getColumnByName('ProductName');
313+
col.hasSummary = true;
314+
fix.detectChanges();
315+
316+
GridFunctions.verifyColumnMergedState(grid, col, [
317+
{ value: 'NetAdvantage', span: 2 },
318+
{ value: 'Ignite UI for JavaScript', span: 3 },
319+
{ value: 'Ignite UI for Angular', span: 3 },
320+
{ value: null, span: 1 }
321+
]);
322+
});
323+
});
324+
304325
describe('Master-Detail', () => {
305326

306327
it('should interrupt merge sequence if a master-detail row is expanded.', () => {

src/app/grid-cellMerging/grid-cellMerging.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h4 class="sample-title">Grid with cell merge</h4>
5050
Value: {{val}},Index: {{cell.row.index}}
5151
</ng-template>
5252
</igx-column>
53-
<igx-column field="ShipCountry" header="Ship Country" [merge]="true" width="200px" sortable="true">
53+
<igx-column field="ShipCountry" [groupable]="true" [hasSummary]="true" header="Ship Country" [merge]="true" width="200px" sortable="true">
5454
</igx-column>
5555
<igx-column field="OrderDate" header="Order Date" width="200px" [merge]="true" [groupable]="true" [dataType]="'date'" sortable="true">
5656
</igx-column>
@@ -95,7 +95,7 @@ <h4 class="sample-title">Hierarchical grid with cell merge</h4>
9595
</igx-column>
9696
<igx-column field="Title" width="200px" [merge]="true" [hasSummary]="true">
9797
</igx-column>
98-
<igx-column field="City" width="200px" [merge]="true" editable="true" sortable="true">
98+
<igx-column [groupable]="true" [hasSummary]="true" field="City" width="200px" [merge]="true" editable="true" sortable="true">
9999
</igx-column>
100100
<igx-row-island [key]="'Orders'" [cellMergeMode]="'always'">
101101
<igx-column field="CustomerID" width="200px">
@@ -113,7 +113,7 @@ <h4 class="sample-title">Tree grid with cell merge</h4>
113113
<button (click)="toggleStrategy()">Toggle strategy</button>
114114
<igx-tree-grid [autoGenerate]="false" [rowSelection]="'single'" [data]="treeData" [cellMergeMode]="'always'" [mergeStrategy]="treeGridMergeStrategy"
115115
childDataKey="ChildCompanies" primaryKey="ID" [expansionDepth]="1" width="800px" [height]="'550px'">
116-
<igx-column field="ContactName" width="200px">
116+
<igx-column field="ContactName" width="200px" [hasSummary]="true">
117117
</igx-column>
118118
<igx-column field="ContactTitle" width="200px"></igx-column>
119119
<igx-column field="Country" width="200px" [merge]="true" sortable="true"></igx-column>

0 commit comments

Comments
 (0)