Bind expanded rows to item ids instead of row number
authorRigel Kent <sendmemail@rigelk.eu>
Sun, 3 May 2020 14:20:19 +0000 (16:20 +0200)
committerRigel Kent <par@rigelk.eu>
Mon, 4 May 2020 13:01:44 +0000 (15:01 +0200)
client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.html
client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html
client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html
client/src/app/+admin/system/jobs/jobs.component.html
client/src/app/+admin/users/user-list/user-list.component.html
client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html
client/src/app/shared/rest/rest-table.ts

index debde2f856cc392c4e3080c96c0362d37f92f2b0..99d8719a38873cfc7dd5cdd3675d14d2c48a8d5a 100644 (file)
@@ -14,6 +14,7 @@
 <p-table
   [value]="videoRedundancies" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage"
   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
+  (onPage)="onPage()" [expandedRowKeys]="expandedRows"
 >
   <ng-template pTemplate="header">
     <tr>
index bf989cb4ed1695a31471534fb400996b7c91b2c1..bf73f916981b593b8ec42d7ab2200534345e9b9b 100644 (file)
@@ -3,6 +3,7 @@
   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true"
   [showCurrentPageReport]="true" i18n-currentPageReportTemplate
   currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports"
+  (onPage)="onPage()" [expandedRowKeys]="expandedRows"
 >
   <ng-template pTemplate="caption">
     <div class="caption">
index f0e83dae9e19dba7b0cad0d35d6fef825f7d77ba..b3f7789df6b6607dfa0d11b81ce27aca7de867b8 100644 (file)
@@ -3,6 +3,7 @@
   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
   [showCurrentPageReport]="true" i18n-currentPageReportTemplate
   currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} blacklisted videos"
+  (onPage)="onPage()" [expandedRowKeys]="expandedRows"
 >
   <ng-template pTemplate="caption">
     <div class="caption">
index 0e31db5477c90d282106ce26b915322a9d3af4ef..05d5731633cee2997d4bc64186bb9f8dc4ccf81b 100644 (file)
@@ -21,7 +21,7 @@
 <p-table
   [value]="jobs" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" dataKey="uniqId"
   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" [first]="pagination.start"
-  [tableStyle]="{'table-layout':'auto'}"
+  [tableStyle]="{'table-layout':'auto'}" (onPage)="onPage()" [expandedRowKeys]="expandedRows"
 >
   <ng-template pTemplate="header">
     <tr>
index e7624f48f6d5a39e310c617ef04c498d2702470d..94c59cb9a89cc6c86465e5927633b3cc8f2ac2d1 100644 (file)
@@ -13,6 +13,7 @@
   [(selection)]="selectedUsers"
   [showCurrentPageReport]="true" i18n-currentPageReportTemplate
   currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} users"
+  (onPage)="onPage()" [expandedRowKeys]="expandedRows"
 >
   <ng-template pTemplate="caption">
     <div class="caption">
index 4b1856b51d5afc1ddc89edf2aab5cce0d853c1f0..7d447cdb363c92f1f9fe89d78ec1ff9164090a76 100644 (file)
@@ -1,6 +1,7 @@
 <p-table
   [value]="videoImports" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage"
   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
+  (onPage)="onPage()" [expandedRowKeys]="expandedRows"
 >
   <ng-template pTemplate="header">
     <tr>
index 891fb7b2b3cc179d00a1f7465ce1bb7bfbdd6d90..4dd0f5ff30d4eb71816baf2678ce4e5c97d7db4e 100644 (file)
@@ -13,6 +13,7 @@ export abstract class RestTable {
   search: string
   rowsPerPageOptions = [ 10, 20, 50, 100 ]
   rowsPerPage = this.rowsPerPageOptions[0]
+  expandedRows = {}
 
   private searchStream: Subject<string>
 
@@ -73,6 +74,10 @@ export abstract class RestTable {
     this.searchStream.next(target.value)
   }
 
+  onPage () {
+    this.expandedRows = {}
+  }
+
   protected abstract loadData (): void
 
   private getSortLocalStorageKey () {