From 25a42e293be90d35afad2096e9db2fa3d617d855 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sun, 3 May 2020 23:01:57 +0200 Subject: Fix rowsPerPage change, add filter clear button, update video-abuse-list search query param dynamically --- client/src/app/shared/rest/rest-table.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/rest/rest-table.ts b/client/src/app/shared/rest/rest-table.ts index 4dd0f5ff3..d4e6cf5f2 100644 --- a/client/src/app/shared/rest/rest-table.ts +++ b/client/src/app/shared/rest/rest-table.ts @@ -74,10 +74,29 @@ export abstract class RestTable { this.searchStream.next(target.value) } - onPage () { + onPage (event: { first: number, rows: number }) { + if (this.rowsPerPage !== event.rows) { + this.rowsPerPage = event.rows + this.pagination = { + start: event.first, + count: this.rowsPerPage + } + this.loadData() + } this.expandedRows = {} } + setTableFilter (filter: string) { + // FIXME: cannot use ViewChild, so create a component for the filter input + const filterInput = document.getElementById('table-filter') as HTMLInputElement + if (filterInput) filterInput.value = filter + } + + resetSearch () { + this.searchStream.next('') + this.setTableFilter('') + } + protected abstract loadData (): void private getSortLocalStorageKey () { -- cgit v1.2.3