Skip to content

Commit 528a950

Browse files
authored
Merge branch 'master' into didimmova/fab-button-text-7542
2 parents 823914c + af2d4b3 commit 528a950

File tree

5 files changed

+32
-4
lines changed

5 files changed

+32
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid-row-selection.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,18 @@ describe('IgxGrid - Row Selection #grid', () => {
17171717
expect(grid.getRowByIndex(3).selected).toBeTrue();
17181718
expect(grid.getRowByIndex(0).selected).toBeFalse();
17191719
});
1720+
1721+
it('Row Pinning: should update checkbox status correctly when there is pinned row and groupBy', () => {
1722+
grid.pinRow(2);
1723+
fix.detectChanges();
1724+
1725+
grid.groupBy({ fieldName: 'InStock', dir: SortingDirection.Desc, ignoreCase: false });
1726+
1727+
GridSelectionFunctions.headerCheckboxClick(grid);
1728+
fix.detectChanges();
1729+
GridSelectionFunctions.verifyHeaderRowCheckboxState(fix, true, false);
1730+
expect(grid.selectedRows.length).toBe(grid.data.length);
1731+
});
17201732
});
17211733

17221734
describe('Integration with CRUD and transactions', () => {

projects/igniteui-angular/src/lib/grids/selection/selection.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,12 @@ export class IgxGridSelectionService {
729729

730730
/** Returns all data in the grid, with applied filtering and sorting and without deleted rows. */
731731
public get allData(): Array<any> {
732-
const allData = this.isFilteringApplied() || this.grid.sortingExpressions.length ?
733-
this.grid.filteredSortedData : this.grid.gridAPI.get_all_data(true);
732+
let allData;
733+
if (this.isFilteringApplied() || this.grid.sortingExpressions.length) {
734+
allData = this.grid.pinnedRecordsCount ? this.grid._filteredSortedUnpinnedData : this.grid.filteredSortedData;
735+
} else {
736+
allData = this.grid.gridAPI.get_all_data(true);
737+
}
734738
return allData.filter(rData => !this.isRowDeleted(this.grid.gridAPI.get_row_id(rData)));
735739
}
736740

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-selection.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,17 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
622622
TreeGridFunctions.verifyHeaderCheckboxSelection(fix, true);
623623
});
624624

625+
it('should have correct header checkbox when add a row and then selectAll rows', () => {
626+
treeGrid.addRow({ ID: 13, Name: 'Michael Cooper', Age: 33, OnPTO: false }, 317);
627+
fix.detectChanges();
628+
629+
TreeGridFunctions.clickHeaderRowSelectionCheckbox(fix);
630+
fix.detectChanges();
631+
632+
expect(treeGrid.selectedRows.length).toBeGreaterThan(treeGrid.flatData.length);
633+
TreeGridFunctions.verifyHeaderCheckboxSelection(fix, true);
634+
});
635+
625636
it('should have correct header checkbox when add a row and undo transaction', fakeAsync(() => {
626637
treeGrid.addRow({ ID: 13, Name: 'Michael Cooper', Age: 33, OnPTO: false }, 317);
627638
tick();

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.pipes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export class IgxTreeGridHierarchizingPipe implements PipeTransform {
3939
flatData, 0, treeGridRecordsMap);
4040
}
4141

42-
grid.flatData = flatData;
42+
grid.flatData = grid.transactions.enabled ?
43+
flatData.filter(rec => !grid.transactions.getState(this.getRowID(primaryKey, rec))) : flatData;
4344
grid.records = treeGridRecordsMap;
4445
grid.rootRecords = hierarchicalRecords;
4546
return hierarchicalRecords;

src/app/grid-row-pinning/grid-row-pinning.sample.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121
<igx-grid [rowEditable]="true" [igxGridState]="options" [allowFiltering]='true' [primaryKey]='"ID"' [pinning]="pinningConfig" [paging]="true"
2222
[columnHiding]='true' [showToolbar]='true' [columnPinning]='true' #grid1 [data]="data" [width]="'800px'"
23-
[height]="'600px'" [rowSelection]="true">
23+
[height]="'600px'" [rowSelection]="'multiple'">
2424

2525
<ng-template igxGridDetail let-dataItem>
2626
<div>

0 commit comments

Comments
 (0)