fix(entity-data-table-checks): optimize setEntity() to prevent UI lag on large datasets
This commit is contained in:
+10
-9
@@ -124,17 +124,18 @@ export class EntityDataTableChecksComponent implements OnInit {
|
|||||||
this.setEntity();
|
this.setEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets Entity to its corresponding values
|
|
||||||
*/
|
|
||||||
setEntity() {
|
setEntity() {
|
||||||
for (let i = 0; i < this.dataSource.data.length; i++) {
|
const entityMap = new Map<string, string>();
|
||||||
for (let j = 0; j < this.entityValues.length; j++) {
|
this.entityValues.forEach((entity: any) => {
|
||||||
if (this.entityValues[j].code === this.dataSource.data[i].entity) {
|
entityMap.set(entity.code, entity.value);
|
||||||
this.dataSource.data[i].entity = this.entityValues[j].value;
|
});
|
||||||
}
|
|
||||||
|
this.dataSource.data.forEach((item: any) => {
|
||||||
|
const entityValue = entityMap.get(item.entity);
|
||||||
|
if (entityValue) {
|
||||||
|
item.entity = entityValue;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user