1
0
Fork 0

Bind expanded rows to item ids instead of row number

This commit is contained in:
Rigel Kent 2020-05-03 16:20:19 +02:00 committed by Rigel Kent
parent 9b1fa49b60
commit d405118360
7 changed files with 11 additions and 1 deletions

View 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>

View 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">

View 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">

View 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>

View 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">

View 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>

View 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 () {