Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last rows of long tables are hidden #321

Open
dsvanidze opened this issue Nov 21, 2023 · 1 comment
Open

Last rows of long tables are hidden #321

dsvanidze opened this issue Nov 21, 2023 · 1 comment
Labels
bug an unexpected problem or unintended behavior

Comments

@dsvanidze
Copy link

dsvanidze commented Nov 21, 2023

Hi,

I use pagedown 0.16.1 and have a number of long tables that extend over several pages. I have noticed that pagedown renders last rows on each table, but they are not visible (see the current output). Update to pagedown 0.20 did not solve the issue. I would expect that the last rows of a long table should be visible on every page, or if they go over the boundaries, they should move to the next page and not just be hidden (see screenshots).

Current output:
current-output

Expected output:
expected-output

I found a workaround that produces the expected output (makes the last row visible), but it would be great if there is a better solution or if the bug is fixed.

const intervalID = setInterval(() => {
  // Wait until Paged.js is loaded and then remove the interval
  if (Paged) {
    clearInterval(intervalID);
  } else {
    return;
  }

  class MyHandler extends Paged.Handler {
    constructor(chunker, polisher, caller) {
      super(chunker, polisher, caller);
    }

    afterPreview() {
      // This is the main part to fix the bug with "column-width": "auto"
      Array.from(
        document.getElementsByClassName("pagedjs_page_content")
      ).forEach((el) => {
        el.style.columnWidth = "auto";
      });
    }
  }

  Paged.registerHandlers(MyHandler);
}, 20);

Here is the R code to reproduce the long table:

data.table(count = factor(1:120)) %>%
  tbl_summary() %>%
  bold_labels() %>%
  as_kable_extra(escape = TRUE)

Tasks

No tasks being tracked yet.
@cderv cderv added the bug an unexpected problem or unintended behavior label Nov 22, 2023
@aske-skov
Copy link

Hello

Thanks for a great package.

I've been experiencing this exact issue too.
I wonder if there's been any developments the last few months? :-)

Best,
Aske

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants