Skip to content

Commit aecdfbe

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Fix bugs with pinning+adding.
1 parent 924468c commit aecdfbe

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4087,6 +4087,9 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
40874087
};
40884088
this._pipeTrigger++;
40894089
this.cdr.detectChanges();
4090+
if (isInPinnedArea) {
4091+
this.calculateGridHeight();
4092+
}
40904093
const row = this.getRowByIndex(index + 1);
40914094
const cell = row.cells.find(c => c.editable);
40924095
if (cell) {
@@ -6568,8 +6571,9 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
65686571
if (commit) {
65696572
this.onRowAdded.pipe(first()).subscribe((args: IRowDataEventArgs) => {
65706573
const rowData = args.data;
6574+
const pinnedIndex = this.pinnedRecords.findIndex(x => x[this.primaryKey] === rowData[this.primaryKey]);
65716575
// A check whether the row is in the current view
6572-
const viewIndex = this.findRecordIndexInView(rowData);
6576+
const viewIndex = pinnedIndex !== -1 ? pinnedIndex : this.findRecordIndexInView(rowData);
65736577
const dataIndex = this.filteredSortedData.findIndex(data => data[this.primaryKey] === rowData[this.primaryKey]);
65746578
const isInView = viewIndex !== -1 && !this.navigation.shouldPerformVerticalScroll(viewIndex, 0);
65756579
const showIndex = isInView ? -1 : dataIndex;

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ export class IgxTreeGridRowComponent extends IgxRowDirective<IgxTreeGridComponen
5050
* @hidden
5151
*/
5252
public get isRoot(): boolean {
53-
return this.treeRow.level === 0;
53+
let treeRec = this.treeRow;
54+
const isPinnedArea = this.pinned && !this.disabled;
55+
if (isPinnedArea) {
56+
treeRec = this.grid.unpinnedRecords.find(x => x.data === this.rowData);
57+
}
58+
return treeRec.level === 0;
5459
}
5560

5661
/**

src/app/tree-grid-add-row/tree-grid-add-row.sample.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div>
2-
<igx-tree-grid #grid [allowFiltering]='true' [data]="data" primaryKey="employeeID" foreignKey="PID"
2+
<igx-tree-grid [pinning]="pinningConfig" #grid [allowFiltering]='true' [data]="data" primaryKey="employeeID" foreignKey="PID"
33
[paging]="false" [width]="'900px'" [height]="'800px'" [rowEditable]="true"
44
(mouseleave)="onMouseLeave(actionstrip)"
55
(mouseover)="onMouseOver($event, grid, actionstrip)">

src/app/tree-grid-add-row/tree-grid-add-row.sample.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { IgxTreeGridComponent } from './../../../projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component';
22
import { Component, ViewChild, OnInit } from '@angular/core';
3-
import { IgxActionStripComponent, IgxGridComponent, DisplayDensity } from 'igniteui-angular';
3+
import { IgxActionStripComponent, IgxGridComponent, DisplayDensity, ColumnPinningPosition, RowPinningPosition } from 'igniteui-angular';
44

55
@Component({
66
selector: 'app-tree-grid-add-row',
@@ -13,6 +13,7 @@ export class TreeGridAddRowSampleComponent implements OnInit {
1313

1414
data: any[];
1515
columns: any[];
16+
pinningConfig = { columns: ColumnPinningPosition.Start, rows: RowPinningPosition.Bottom };
1617

1718
onMouseOver(event, grid, actionStrip) {
1819
if (event.target.nodeName.toLowerCase() === 'igx-grid-cell') {

0 commit comments

Comments
 (0)