Skip to content

Pagination in relationship field does not change displayed items #35106

@oidacra

Description

@oidacra

Problem Statement

In the Edit Content view, when a relationship field has enough related items to trigger pagination (e.g., more than 6), the pagination controls appear correctly showing "1 of 2". However, clicking next/previous page does not change the displayed items — the same items are always shown regardless of the selected page. Adding more items also keeps showing everything on page 1.

Root Cause Analysis:
The p-table in dot-relationship-field.component.html has [paginator]="false". When PrimeNG's paginator is disabled, it ignores [first] and [rows] and renders all items. The store correctly updates offset and currentPage, but the template binds [value]="data" (the full array) without slicing it to the current page.

Files involved:

  • core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/components/dot-relationship-field/dot-relationship-field.component.html
  • core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.ts

Steps to Reproduce

  1. Open Edit Content for a content type that has a relationship field
  2. Add more than 6 related items to the relationship field
  3. Observe pagination appears showing "1 of 2"
  4. Click the next page button
  5. The same items remain displayed — no change

Acceptance Criteria

  • Clicking next/previous page in the relationship field pagination displays only the items for that page
  • Items per page respects the configured rowsPerPage (currently 6)
  • Page indicator reflects the correct current page

Suggested Fix

Add a paginatedData computed signal to RelationshipFieldStore that slices data based on offset and rowsPerPage, and use it in the template's [value] binding instead of the full data array.

dotCMS Version

Latest from main branch

Severity

Medium - Some functionality impacted

Links

NA

Metadata

Metadata

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions