Explorar el Código

fix(admin-ui): Fix incorrect pagination range (#3404)

Naoya Hatayama hace 9 meses
padre
commit
1ee2d4505f

+ 3 - 2
packages/admin-ui/src/lib/core/src/shared/components/data-table-2/data-table2.component.ts

@@ -197,8 +197,9 @@ export class DataTable2Component<T> implements AfterContentInit, OnChanges, OnDe
 
     ngOnChanges(changes: SimpleChanges) {
         if (changes.items) {
-            this.currentStart = this.itemsPerPage * (this.currentPage - 1);
-            this.currentEnd = this.currentStart + changes.items.currentValue?.length;
+            const startIndex = this.itemsPerPage * (this.currentPage - 1);
+            this.currentStart = startIndex + 1;
+            this.currentEnd = startIndex + changes.items.currentValue?.length;
             this.selectionManager?.setCurrentItems(this.items);
         }
     }