diff --git a/frontend/src/app/modules/imports/components/destinations/destinations.component.html b/frontend/src/app/modules/imports/components/destinations/destinations.component.html index 707987fa1a..739097f7fd 100644 --- a/frontend/src/app/modules/imports/components/destinations/destinations.component.html +++ b/frontend/src/app/modules/imports/components/destinations/destinations.component.html @@ -9,6 +9,7 @@ [clearable]="clearable" [virtualScroll]="true" [formControl]="parentFormControl" + (clear)="onClear.emit()" >
diff --git a/frontend/src/app/modules/imports/components/destinations/destinations.component.ts b/frontend/src/app/modules/imports/components/destinations/destinations.component.ts index baed93066e..2bf82a5e77 100644 --- a/frontend/src/app/modules/imports/components/destinations/destinations.component.ts +++ b/frontend/src/app/modules/imports/components/destinations/destinations.component.ts @@ -1,7 +1,8 @@ -import { Component, Input } from '@angular/core'; +import { Component, Input, Output } from '@angular/core'; import { DataService } from '../../services/data.service'; import { Destination } from '../../models/import.model'; import { GenericFormComponent } from '@geonature_common/form/genericForm.component'; +import { EventEmitter } from '@angular/core'; @Component({ selector: 'pnx-destinations', @@ -12,6 +13,7 @@ export class DestinationsComponent extends GenericFormComponent { destinations: Array; @Input() bindValue: string = 'code'; + @Output() onClear = new EventEmitter(); constructor(private _ds: DataService) { super(); diff --git a/frontend/src/app/modules/imports/components/import_list/import-list.component.html b/frontend/src/app/modules/imports/components/import_list/import-list.component.html index 7e9cae98ac..9ec95f93d1 100644 --- a/frontend/src/app/modules/imports/components/import_list/import-list.component.html +++ b/frontend/src/app/modules/imports/components/import_list/import-list.component.html @@ -11,7 +11,8 @@
Liste des imports
'Import.Destinations' | translate | lowercase }}" [parentFormControl]="selectDestinationForm" - (onChange) = "onImportList()" + (onChange) = "resetPage()" + (onClear) = "resetPage()" class="flex-fill pr-1" >
diff --git a/frontend/src/app/modules/imports/components/import_list/import-list.component.ts b/frontend/src/app/modules/imports/components/import_list/import-list.component.ts index a864a6c06a..f662b0eae5 100644 --- a/frontend/src/app/modules/imports/components/import_list/import-list.component.ts +++ b/frontend/src/app/modules/imports/components/import_list/import-list.component.ts @@ -84,7 +84,15 @@ export class ImportListComponent implements OnInit { */ updateSearchQuery() { this.searchString = this.search.value; - this.onImportList(); + this.resetPage(); + } + + /** + * Resets the page offset before updating the import list + */ + resetPage() { + this.offset = 0; + this.updateImports(); }