Skip to content

Commit 85cea49

Browse files
committed
Merge remote-tracking branch 'origin/master' into mkirova/row-pinning-state-persist
2 parents a382538 + bcda167 commit 85cea49

File tree

4 files changed

+67
-19
lines changed

4 files changed

+67
-19
lines changed

projects/igniteui-angular/src/lib/core/styles/components/navbar/_navbar-theme.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,6 @@
155155

156156
%igx-navbar-title {
157157
@include igx-type-style($type-scale, $title);
158+
margin-bottom: 0;
158159
}
159160
}

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,50 @@ describe('Row Pinning #grid', () => {
699699
verifyDOMMatchesLayoutSettings(gridUnpinnedRow, fix.componentInstance.colGroups);
700700
});
701701
});
702+
describe(' Hiding', () => {
703+
beforeEach(fakeAsync(() => {
704+
fix = TestBed.createComponent(GridRowPinningComponent);
705+
fix.detectChanges();
706+
grid = fix.componentInstance.instance;
707+
tick();
708+
fix.detectChanges();
709+
}));
710+
711+
it('should hide columns in pinned and unpinned area', () => {
712+
// pin 2nd data row
713+
grid.pinRow(fix.componentInstance.data[1]);
714+
fix.detectChanges();
715+
const hiddenCol = grid.columns[1];
716+
hiddenCol.hidden = true;
717+
fix.detectChanges();
718+
719+
const pinnedCells = grid.pinnedRows[0].cells;
720+
expect(pinnedCells.filter(cell => cell.column.field === hiddenCol.field).length).toBe(0);
721+
722+
const unpinnedCells = grid.rowList.first.cells;
723+
expect(unpinnedCells.filter(cell => cell.column.field === hiddenCol.field).length).toBe(0);
724+
725+
expect(pinnedCells.length).toBe(unpinnedCells.length);
726+
727+
const headerCells = grid.headerCellList;
728+
expect(headerCells.filter(cell => cell.column.field === hiddenCol.field).length).toBe(0);
729+
730+
expect(grid.pinnedRows.length).toBe(1);
731+
const pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
732+
expect(pinRowContainer.length).toBe(1);
733+
expect(pinRowContainer[0].children.length).toBe(1);
734+
expect(pinRowContainer[0].children[0].context.rowID).toBe(fix.componentInstance.data[1]);
735+
expect(pinRowContainer[0].children[0].nativeElement).toBe(grid.getRowByIndex(0).nativeElement);
736+
737+
expect(grid.getRowByIndex(1).rowID).toBe(fix.componentInstance.data[0]);
738+
expect(grid.getRowByIndex(2).rowID).toBe(fix.componentInstance.data[2]);
739+
740+
// 1 records pinned + 2px border
741+
expect(grid.pinnedRowHeight).toBe(grid.renderedRowHeight + 2);
742+
const expectedHeight = parseInt(grid.height, 10) - grid.pinnedRowHeight - 18 - grid.theadRow.nativeElement.offsetHeight;
743+
expect(grid.calcHeight - expectedHeight).toBeLessThanOrEqual(1);
744+
});
745+
});
702746
});
703747

704748
@Component({

src/app/grid-column-pinning/grid-column-pinning.sample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class GridColumnPinningSampleComponent implements OnInit {
103103

104104
togglePinRow(index) {
105105
const rec = this.data[index];
106-
this.grid1.isRecordPinned(rec) ?
106+
!this.grid1.isRecordPinned(rec) ?
107107
this.grid1.pinRow(rec) :
108108
this.grid1.unpinRow(rec)
109109
}

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

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,26 @@
1313
<igx-switch (change)='onRowChange()' style="padding-left: 10px"> Bottom Row Pinning toggle</igx-switch>
1414
<igx-switch (change)='onChange()' style="padding-left: 10px"> Right Column Pinning toggle</igx-switch>
1515
</div>
16-
<igx-grid [igxGridState]="options" [allowFiltering]='true' [primaryKey]='"ID"' [pinning]="pinningConfig" [showToolbar]='true' [columnPinning]='true' #grid1 [data]="data" [width]="'800px'" [height]="'500px'" [rowSelectable]="false">
17-
<igx-column width='70px' [filterable]='false'>
18-
<ng-template igxCell let-cell="cell" let-val>
19-
<igx-icon class="pin-icon" (mousedown)="togglePining(cell.row, $event)">
20-
{{cell.row.pinned ? 'lock' : 'lock_open'}}
21-
</igx-icon>
22-
</ng-template>
23-
</igx-column>
24-
<igx-column width='100px' [filterable]='false'>
25-
<ng-template igxCell let-cell="cell" let-val>
26-
<button (click)="grid1.deleteRow(cell.row.rowID)">Delete</button>
27-
</ng-template>
28-
</igx-column>
29-
<igx-column *ngFor="let c of columns" [sortable]="true" [field]="c.field" [header]="c.field" [width]="c.width" [pinned]='c.pinned' [groupable]='c.groupable'
30-
[hidden]='c.hidden' [editable]='true'>
31-
</igx-column>
32-
</igx-grid>
16+
<igx-grid [igxGridState]="options" [allowFiltering]='true' [primaryKey]='"ID"' [pinning]="pinningConfig"
17+
[columnHiding]='true' [showToolbar]='true' [columnPinning]='true' #grid1 [data]="data" [width]="'800px'"
18+
[height]="'500px'" [rowSelectable]="false">
19+
<igx-column width='70px' [filterable]='false'>
20+
<ng-template igxCell let-cell="cell" let-val>
21+
<igx-icon class="pin-icon" (mousedown)="togglePining(cell.row, $event)">
22+
{{cell.row.pinned ? 'lock' : 'lock_open'}}
23+
</igx-icon>
24+
</ng-template>
25+
</igx-column>
26+
<igx-column width='100px' [filterable]='false'>
27+
<ng-template igxCell let-cell="cell" let-val>
28+
<button (click)="grid1.deleteRow(cell.row.rowID)">Delete</button>
29+
</ng-template>
30+
</igx-column>
31+
<igx-column *ngFor="let c of columns" [sortable]="true" [field]="c.field" [header]="c.field"
32+
[width]="c.width" [pinned]='c.pinned' [groupable]='c.groupable' [hidden]='c.hidden'
33+
[editable]='true'>
34+
</igx-column>
35+
</igx-grid>
3336
</div>
3437
</div>
35-
</div>
38+
</div>

0 commit comments

Comments
 (0)