diegomura / diegomura/react-pdf

Show Headers for table only when there are elements in the list

Open
#3,023 1 comment 0 reactions 0 assignees View on GitHub
new feature
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Is your feature request related to a problem? Please describe.**
The `fixed` property makes an element to be viewed in all pages. I'm using it to make the headers of my table to be seen in all of them.

But the problem is that, in my case, I have other elements to be shown after the table, and if these elements break into a new page, the header of the previous table is still showing. Example:

- The problem
```
PDF CONTENT

PAGE 1
HEADER (fixed)

TABLE HEADER (fixed)
TABLE BODY

FOOTER (fixed)
PAGE 1

PAGE 2
HEADER (fixed)

TABLE HEADER (fixed)
TABLE BODY

FOOTER (fixed)
PAGE 2

PAGE 3
HEADER (fixed)

TABLE HEADER (fixed)
NO ELEMENTS IN THE LIST TO SHOW =================> HERE

OTHER CONTENT

FOOTER (fixed)
PAGE 3

PDF CONTENT
```

- What I needd
```
PDF CONTENT

PAGE 1
HEADER (fixed)

TABLE HEADER (fixed)
TABLE BODY

FOOTER (fixed)
PAGE 1

PAGE 2
HEADER (fixed)

TABLE HEADER (fixed)
TABLE BODY

FOOTER (fixed)
PAGE 2

PAGE 3
HEADER (fixed)

OTHER CONTENT

FOOTER (fixed)
PAGE 3

PDF CONTENT
```

**Describe the solution you'd like**
Maybe the `fixed` property should stick its content based on page, not in the whole document (taking into consideration that this property has effect in all document pages). Like, if I still have elements to show in this table, the table header is fixed.

To summarize: `This element is fixed as long as X condition (list elements are present in the page, for instance) is met`

**Describe alternatives you've considered**
N/A

**Additional context**
N/A

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by tracing how the fixed property is handled for table headers and paginated lists, then determine how page-specific list presence should affect repeated content. Done means table headers repeat while list elements remain, but stop appearing on later pages containing only other content.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.