Skip to content

Commit

Permalink
chore(demo): sort fix for page and minAge (#9469)
Browse files Browse the repository at this point in the history
  • Loading branch information
iriiv authored Oct 14, 2024
1 parent 9c91f0f commit df731e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<td [colSpan]="columns.length">
<tui-table-pagination
class="tui-space_top-2"
[page]="(page$ | async) || 0"
[total]="(total$ | async) || 0"
(paginationChange)="onPagination($event)"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
share,
startWith,
switchMap,
tap,
timer,
} from 'rxjs';

Expand Down Expand Up @@ -135,19 +136,23 @@ function getAge({dob}: User): number {
})
export default class Example {
private readonly size$ = new BehaviorSubject(10);
private readonly page$ = new BehaviorSubject(0);
protected readonly page$ = new BehaviorSubject(0);

protected readonly direction$ = new BehaviorSubject<-1 | 1>(-1);
protected readonly sorter$ = new BehaviorSubject<Key>('name');

protected readonly minAge = new FormControl(21);
protected readonly minAge$ = tuiControlValue<number>(this.minAge).pipe(
debounceTime(1000),
tap(() => this.page$.next(0)),
);

protected readonly request$ = combineLatest([
this.sorter$,
this.direction$,
this.page$,
this.size$,
tuiControlValue<number>(this.minAge),
this.minAge$,
]).pipe(
// zero time debounce for a case when both key and direction change
debounceTime(0),
Expand Down

0 comments on commit df731e7

Please sign in to comment.