Skip to content

Commit 89fa255

Browse files
authored
fix(tgrid): create and assign unique data ids (#3840)
1 parent 84a27d3 commit 89fa255

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/app/tree-grid/tree-grid-export-visualization/tree-grid-export-visualization.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="grid__wrapper">
22
<igx-tree-grid [igxPreventDocumentScroll]="true" [data]="localData" [autoGenerate]="false" primaryKey="ID"
3-
foreignKey="ParentID" height="350px" width="100%" primaryKey="ID">
3+
foreignKey="ParentID" height="350px" width="100%">
44
<igx-grid-toolbar #toolbar>
55
<igx-grid-toolbar-actions>
66
<button [disabled]="toolbar.showProgress" (click)="longRunning(toolbar)" igxButton>

src/app/tree-grid/tree-grid-export-visualization/tree-grid-export-visualization.component.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,19 @@ export class TreeGridExportVisualizationComponent {
1717
private data = ORDERS_DATA;
1818

1919
constructor() {
20-
for (let i = 0; i < 15000; i += 3) {
20+
const offsetStep = Math.max(...this.data.map(item => item.ID)) + 1;
21+
22+
for (let i = 0; i < 9000; i += 3) {
23+
const offset = (i / 3) * offsetStep;
24+
2125
for (let c = 0; c < this.data.length; c++) {
22-
this.localData.push(this.data[c]);
26+
const item = this.data[c];
27+
this.localData.push({
28+
...item,
29+
ID: item.ID + offset,
30+
ParentID: item.ParentID === -1 ? -1 : item.ParentID + offset,
31+
OrderDate: new Date(item.OrderDate)
32+
});
2333
}
2434
}
2535
}

0 commit comments

Comments
 (0)