Skip to content

Commit 4c2d7b3

Browse files
authored
Merge branch 'master' into mpopov/disabled-button
2 parents ae37497 + caf01af commit 4c2d7b3

File tree

7 files changed

+22
-21
lines changed

7 files changed

+22
-21
lines changed

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
8989
*/
9090
@Input()
9191
public get row(): RowType {
92-
return this.grid.createRow(this.intRow.index, this.intRow.rowData);
92+
return this.grid.createRow(this.intRow.index);
9393
}
9494

9595
/**
@@ -174,7 +174,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
174174
* N = number of visible cells in the grid, leading to massive performance degradation in large grids.
175175
*/
176176
Object.defineProperty(ctx, 'cell', {
177-
get: () => this.getCellType()
177+
get: () => this.getCellType(true)
178178
});
179179
return ctx;
180180
}
@@ -1040,7 +1040,8 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
10401040
this.nativeElement.removeEventListener('pointerup', this.pointerup);
10411041
}
10421042

1043-
private getCellType(): CellType {
1044-
return new IgxGridCell(this.grid, this.intRow.index, this.column.field);
1043+
private getCellType(useRow?: boolean): CellType {
1044+
const rowID = useRow ? this.grid.createRow(this.intRow.index, this.intRow.rowData) : this.intRow.index;
1045+
return new IgxGridCell(this.grid, rowID, this.column.field);
10451046
}
10461047
}

projects/igniteui-angular/src/lib/grids/columns/column.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,8 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy {
12091209
*
12101210
*/
12111211
public get cells(): CellType[] {
1212+
// TODO calclulate index for remote data scenarios
1213+
// check indexes in this.dataRowList.first and this.dataRowList.last
12121214
return this.grid.dataView
12131215
.map((rec, index) => {
12141216
if (!this.grid.isGroupByRecord(rec) && !this.grid.isSummaryRow(rec)) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class IgxGridCell implements CellType {
5353
* @memberof IgxGridCell
5454
*/
5555
public get row(): RowType {
56-
return this.grid.createRow(this._rowIndex);
56+
return this._row || this.grid.createRow(this._rowIndex);
5757
}
5858

5959
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,10 +1138,10 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
11381138
/**
11391139
* @hidden @internal
11401140
*/
1141-
public createRow(index: number): RowType {
1141+
public createRow(index: number, data?: any): RowType {
11421142
let row: RowType;
11431143

1144-
const rec: any = this.dataView[index];
1144+
const rec: any = data ?? this.dataView[index];
11451145

11461146
if (rec && this.isGroupByRecord(rec)) {
11471147
row = new IgxGroupByRow(this, index, rec);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,12 +1116,12 @@ describe('Row Drag Tests #tGrid', () => {
11161116

11171117
rowDragDirective.onPointerDown(pointerDownEvent);
11181118
rowDragDirective.onPointerMove(pointerMoveEvent);
1119-
verifyRowDragStartEvent(dragGrid, dragGrid.getRowByIndex(rowToDrag.index),
1119+
verifyRowDragStartEvent(dragGrid, dragGrid.getRowByKey(rowToDrag.rowID),
11201120
rowToDrag.nativeElement, rowDragDirective, 1);
11211121
rowDragDirective.onPointerMove(pointerMoveToDropEvent);
11221122
rowDragDirective.onPointerUp(pointerUpEvent);
11231123
fixture.detectChanges();
1124-
verifyRowDragEndEvent(dragGrid, dragGrid.getRowByIndex(rowToDrag.index),
1124+
verifyRowDragEndEvent(dragGrid, dragGrid.getRowByKey(rowToDrag.rowID),
11251125
rowToDrag.nativeElement, rowDragDirective, false, 1);
11261126

11271127
// second level row
@@ -1133,11 +1133,11 @@ describe('Row Drag Tests #tGrid', () => {
11331133

11341134
rowDragDirective.onPointerDown(pointerDownEvent);
11351135
rowDragDirective.onPointerMove(pointerMoveEvent);
1136-
verifyRowDragStartEvent(dragGrid, dragGrid.getRowByIndex(rowToDrag.index), rowToDrag.nativeElement, rowDragDirective, 2);
1136+
verifyRowDragStartEvent(dragGrid, dragGrid.getRowByKey(rowToDrag.rowID), rowToDrag.nativeElement, rowDragDirective, 2);
11371137
rowDragDirective.onPointerMove(pointerMoveToDropEvent);
11381138
rowDragDirective.onPointerUp(pointerUpEvent);
11391139
fixture.detectChanges();
1140-
verifyRowDragEndEvent(dragGrid, dragGrid.getRowByIndex(rowToDrag.index), rowToDrag.nativeElement, rowDragDirective, false, 2);
1140+
verifyRowDragEndEvent(dragGrid, dragGrid.getRowByKey(rowToDrag.rowID), rowToDrag.nativeElement, rowDragDirective, false, 2);
11411141

11421142
// third level row
11431143
dragIndicatorElement = dragIndicatorElements[3].nativeElement;
@@ -1148,12 +1148,12 @@ describe('Row Drag Tests #tGrid', () => {
11481148

11491149
rowDragDirective.onPointerDown(pointerDownEvent);
11501150
rowDragDirective.onPointerMove(pointerMoveEvent);
1151-
verifyRowDragStartEvent(dragGrid, dragGrid.getRowByIndex(rowToDrag.index),
1151+
verifyRowDragStartEvent(dragGrid, dragGrid.getRowByKey(rowToDrag.rowID),
11521152
rowToDrag.nativeElement, rowDragDirective, 3);
11531153
rowDragDirective.onPointerMove(pointerMoveToDropEvent);
11541154
rowDragDirective.onPointerUp(pointerUpEvent);
11551155
fixture.detectChanges();
1156-
verifyRowDragEndEvent(dragGrid, dragGrid.getRowByIndex(rowToDrag.index),
1156+
verifyRowDragEndEvent(dragGrid, dragGrid.getRowByKey(rowToDrag.rowID),
11571157
rowToDrag.nativeElement, rowDragDirective, false, 3);
11581158
});
11591159
});

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,6 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
477477
return new IgxHierarchicalGridRow(this, index, rec);
478478
}
479479

480-
// TODO cell
481-
// isHier .childGridsData?
482480
/**
483481
* @hidden @internal
484482
*/
@@ -827,9 +825,9 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
827825
/**
828826
* @hidden
829827
*/
830-
public createRow(index: number): RowType {
828+
public createRow(index: number, data?: any): RowType {
831829
let row: RowType;
832-
const rec: any = this.dataView[index];
830+
const rec: any = data ?? this.dataView[index];
833831

834832
if (!row && rec && !rec.childGridsData) {
835833
row = new IgxHierarchicalGridRow(this, index, rec);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,19 +825,19 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
825825
/**
826826
* @hidden
827827
*/
828-
public createRow(index: number): RowType {
828+
public createRow(index: number, data?: any): RowType {
829829
let row: RowType;
830-
const rec: any = this.dataView[index];
830+
const rec: any = data ?? this.dataView[index];
831831

832832
if (this.isSummaryRow(rec)) {
833833
row = new IgxSummaryRow(this, index, rec.summaries, GridInstanceType.TreeGrid);
834834
}
835835

836836
if (!row && rec) {
837837
const isTreeRow = this.isTreeRow(rec);
838-
const data = isTreeRow ? rec.data : rec;
838+
const dataRec = isTreeRow ? rec.data : rec;
839839
const treeRow = isTreeRow ? rec : undefined;
840-
row = new IgxTreeGridRow(this, index, data, treeRow);
840+
row = new IgxTreeGridRow(this, index, dataRec, treeRow);
841841
}
842842

843843
return row;

0 commit comments

Comments
 (0)