diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-04-03 19:48:54 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-04-03 19:48:54 -0400 |
commit | ad651c44ce2515d497c8e5214147c69126e25903 (patch) | |
tree | 3696cd84c1a1c3f105b09c1426ba13df4940f9a0 /ufund-ui/src/app/components/need-list/need-list.component.ts | |
parent | 3cb145756351abd152acbcb5cabbf223fddf22bb (diff) | |
download | JellySolutions-ad651c44ce2515d497c8e5214147c69126e25903.tar.gz JellySolutions-ad651c44ce2515d497c8e5214147c69126e25903.tar.bz2 JellySolutions-ad651c44ce2515d497c8e5214147c69126e25903.zip |
abstraction working with search and sort
Diffstat (limited to 'ufund-ui/src/app/components/need-list/need-list.component.ts')
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.ts | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index d027690..cd7debb 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -11,10 +11,10 @@ import {Observable} from 'rxjs'; export class NeedListComponent implements OnChanges { @Input({required: true}) needs!: Need[] + @Input() itemsPerPage: number = 5; visibleNeeds: Need[] = []; currentPage: number = 0; - itemsPerPage: number = 5; totalPages: number = 0; constructor( @@ -45,19 +45,9 @@ export class NeedListComponent implements OnChanges { this.updateVisibleNeeds() } - editNeedsPerPage(amount: number) { - this.itemsPerPage = amount; - this.updateVisibleNeeds(); - } - updateVisibleNeeds() { this.totalPages = Math.ceil(this.needs.length / this.itemsPerPage); this.visibleNeeds = this.needs.slice(this.currentPage * this.itemsPerPage, (this.currentPage + 1) * this.itemsPerPage); } - - resetVisibleNeeds() { - this.currentPage = 0; - this.updateVisibleNeeds(); - } } |