Track by id
This commit is contained in:
parent
057fbfd2a8
commit
5b6f35cbc1
@ -9,6 +9,7 @@ import { EntitiesService } from './services';
|
||||
import { IListable, ListingMode, ListingModes, TableColumnConfig } from './models';
|
||||
|
||||
export const DefaultListingServices = [FilterService, SearchService, EntitiesService, SortingService] as const;
|
||||
export const DefaultListingServicesTmp = [FilterService, SearchService, SortingService] as const;
|
||||
|
||||
@Directive()
|
||||
export abstract class ListingComponent<T extends IListable> extends AutoUnsubscribe implements OnDestroy {
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<div
|
||||
(mouseenter)="itemMouseEnterFn && itemMouseEnterFn(entity)"
|
||||
(mouseleave)="itemMouseLeaveFn && itemMouseLeaveFn(entity)"
|
||||
*cdkVirtualFor="let entity of listingComponent.sortedDisplayedEntities$ | async"
|
||||
*cdkVirtualFor="let entity of listingComponent.sortedDisplayedEntities$ | async; trackBy: trackById"
|
||||
[ngClass]="getTableItemClasses(entity)"
|
||||
[routerLink]="entity.routerLink"
|
||||
>
|
||||
|
||||
@ -65,6 +65,10 @@ export class TableComponent<T extends IListable> implements OnInit {
|
||||
return this.listingComponent.tableHeaderLabel;
|
||||
}
|
||||
|
||||
trackById(index: number, entity: T): string {
|
||||
return entity.id;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.listingComponent.noContent$.subscribe(() => {
|
||||
setTimeout(() => {
|
||||
|
||||
@ -23,7 +23,7 @@ export class LoadingService {
|
||||
return remainingLoadingTime > 0 ? this._stopAfter(remainingLoadingTime) : this._stop();
|
||||
}
|
||||
|
||||
loadWhile(func: Promise<void>): void {
|
||||
loadWhile(func: Promise<unknown>): void {
|
||||
this.start();
|
||||
|
||||
func.then(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user