Skip to content

Commit

Permalink
fix(admin-ui): Reinstate serialized filter state in url
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Oct 2, 2023
1 parent e2cb74b commit a5bc0c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ export class DataTableFilterCollection<FilterInput extends Record<string, any> =
}

connectToRoute(route: ActivatedRoute) {
this.valueChanges.subscribe(() => {
this.router.navigate(['./'], {
queryParams: { [this.#filtersQueryParamName]: this.serialize(), page: 1 },
relativeTo: route,
queryParamsHandling: 'merge',
});
});
route.queryParamMap
.pipe(
map(params => params.get(this.#filtersQueryParamName)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
</div>
</ng-container>
<div class="apply-wrapper mt-2">
<button class="button" (click)="activate()" [disabled]="!formControl?.valid">
<button class="button" (click)="activate($event)" [disabled]="!formControl?.valid">
<span>{{ 'common.apply' | translate }}</span>
<clr-icon shape="check"></clr-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ export class DataTableFiltersComponent implements AfterViewInit {
}
}

activate() {
activate(event: Event) {
event.preventDefault();
if (!this.selectedFilter) {
return;
}
Expand Down

0 comments on commit a5bc0c1

Please sign in to comment.