Skip to content

Commit 1175ee3

Browse files
authored
Merge branch 'master' into mkirova/fix-pinned-area-changes
2 parents ee1e5f9 + a55860e commit 1175ee3

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

projects/igniteui-angular/src/lib/grids/grid/expandable-cell.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<ng-template #defaultPinnedIndicator>
2+
<igx-chip *ngIf="displayPinnedChip" class="igx-grid__td--pinned-chip" [disabled]="true" [displayDensity]="'compact'">{{ grid.resourceStrings.igx_grid_pinned_row_indicator }}</igx-chip>
3+
</ng-template>
14
<ng-template #defaultCell>
25
<div igxTextHighlight style="pointer-events: none" [cssClass]="highlightClass" [activeCssClass]="activeHighlightClass" [groupName]="gridID"
36
[value]="formatter ? formatter(value) : column.dataType === 'number' ? (value | igxdecimal: grid.locale) : column.dataType === 'date' ? (value | igxdate: grid.locale) : value"
@@ -33,6 +36,8 @@
3336
</ng-container>
3437
</div>
3538
</ng-container>
39+
<ng-container *ngTemplateOutlet="pinnedIndicatorTemplate; context: context">
40+
</ng-container>
3641
<ng-container *ngTemplateOutlet="template; context: context">
3742
</ng-container>
3843
<ng-template #defaultExpandedTemplate>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ describe('Row Pinning #grid', () => {
459459
expect(grid.expansionStates.get(pinnedRow.rowID)).toBeTruthy();
460460
// disabled row should have expand icon
461461
expect(firstRowIconName).toEqual('expand_more');
462+
// disabled row should have chip
463+
const cell = grid.getRowByIndex(0).cells.first;
464+
expect(cell.nativeElement.getElementsByClassName('igx-grid__td--pinned-chip').length).toBe(1);
462465
// pinned row shouldn't have expand icon
463466
const hasIconForPinnedRow = pinnedRow.cells.first.nativeElement.querySelector('igx-icon');
464467
expect(hasIconForPinnedRow).toBeNull();

projects/igniteui-angular/src/lib/grids/state.directive.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,15 @@ describe('IgxGridState - input properties #grid', () => {
414414
expect(grid.pinnedRows[1].rowID).toBe(3);
415415
gridState = state.getState(true, 'rowPinning');
416416
expect(gridState).toBe(rowPinState);
417+
418+
grid.getRowByIndex(3).pin();
419+
420+
state.setState(rowPinStateObject);
421+
fix.detectChanges();
422+
423+
expect(grid.pinnedRows.length).toBe(2);
424+
expect(grid.pinnedRows[0].rowID).toBe(1);
425+
expect(grid.pinnedRows[1].rowID).toBe(3);
417426
});
418427

419428
it('setState should correctly restore grid cell selection state from string', () => {

projects/igniteui-angular/src/lib/grids/state.directive.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ export class IgxGridStateDirective {
478478
}
479479

480480
private restoreRowPinning(state: any[]) {
481+
// clear current state.
482+
this.grid.pinnedRows.forEach(row => row.unpin());
481483
state.forEach(rowID => this.grid.pinRow(rowID));
482484
}
483485

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<ng-template igxToolbarCustomContent>
3333
<app-grid-search-box [grid]="grid1" [style.width]="'400px'"></app-grid-search-box>
3434
</ng-template>
35-
<igx-column width='120px' [filterable]='false'>
35+
<igx-column width='150px' [filterable]='false'>
3636
<ng-template igxCell let-cell="cell" let-val>
3737
<igx-icon class="pin-icon" (mousedown)="togglePining(cell.row, $event)"
3838
fontSet="filtering-icons" name="{{cell.row.pinned ? 'unpin' : 'pin'}}">

0 commit comments

Comments
 (0)