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