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

Utilizing Scroller DataTable extension with datatable(fillContainer = TRUE, ...) #1139

Open
3 tasks done
jthompson-arcus opened this issue May 29, 2024 · 1 comment
Open
3 tasks done

Comments

@jthompson-arcus
Copy link

The DataTable Scroller extension does not work correctly when using datatable(fillContainer = TRUE, ...). I was able to figure out a work around for my issue utilizing the "scrollResize" plugin. Stackoverflow issue and workaround can be found here. Below is a toy example showing the issue. When the table loads, everything looks okay, but after you start scrolling the table gets reduced to only 9 rows. This is true regardless of the value given to the scrollY option. You will also notice that the pagination gets reduced to only one record (i.e. "Showing 44 to 44 of 150 entries").

library(shiny)
library(DT)

ui <- fluidPage(
  div(
    style = "height: 500px",
    DT::DTOutput("table", height = "100%")
  )
)

server <- function(input, output, session) {
  output$table <- DT::renderDT({
    DT::datatable(
      iris,
      options = list(
        scrollY = 200,
        scroller = TRUE,
        deferRender = TRUE
      ),
      fillContainer = TRUE,
      extensions = "Scroller",
    )
  })
}

shinyApp(ui, server)

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/DT').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@alanfarahani
Copy link

I wanted to add that I would have opened an identical issue, as I have encountered this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants