Skip to content

Commit

Permalink
chore: calc page
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaZhem committed Aug 29, 2024
1 parent 0f8364f commit 71fb37b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
*tuiTextfieldDropdown
[itemContent]="content"
[items]="itemsSort"
(itemClick)="changePage()"
/>
</button>
<tui-pagination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export class TableComponent {

protected index = 0;
protected sizeSort = signal(10);
protected sizeSortPrevious = signal(10);
protected readonly itemsSort = [10, 50, 100];

protected readonly items = ['43.7ms', '45.7ms', '53.2ms'];
Expand Down Expand Up @@ -393,6 +394,11 @@ export class TableComponent {
this.searchByCreator.set(this.form.value.searchByCreator);
}

protected changePage(): void {
this.index = Math.floor((this.index * this.sizeSortPrevious()) / this.sizeSort());
this.sizeSortPrevious.set(this.sizeSort());
}

protected readonly content: TuiStringHandler<TuiContext<number>> = ({$implicit}) =>
`${$implicit} items per page`;
}

0 comments on commit 71fb37b

Please sign in to comment.