-
Notifications
You must be signed in to change notification settings - Fork 182
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
Table Only Displaying Half the Rows #371
Comments
Sorry about that. Could you help me try two things?
|
Thanks for the quick response @yihui
library(shiny)
library(DT)
server <- function(input, output) {
output$irisData <- DT::renderDataTable({
DT::datatable(iris,
rownames = FALSE,
escape = FALSE,
class = 'compact cell-border stripe hover',
extensions = c('Scroller'),
options = list(dom = 'T<"clear">frtiS',
deferRender = TRUE,
scrollY = 500,
scrollCollapse = TRUE
)
) %>%
formatStyle(
'Petal.Length',
backgroundColor = styleInterval(c(1.5, 3.5, 5), c('#9BF59B', '#FFEB99', '#F3B73D', 'transparent'))
)
})
}
ui <- fluidPage(
div(style = 'overflow-x: scroll', DT::dataTableOutput("irisData"))
)
shinyApp(ui = ui, server = server) Setting |
Thanks a lot for creating the reproducible example! The Scroller extension and scrolling options have always been my headache... I see |
While It's not urgent that this issue is resolved and I can live with |
Unfortunately, I've had to revert to DT 0.1 With I also think the "Processing...." message is a nicer user experience than just the angled purple lines. Happy to provide an example data set and code if it would help. |
Sorry to hear that, but I don't have time to investigate this issue at the moment. I'll take a closer look the next time I work on DT. Thanks! |
@phillc73 Although the issue has been opened for more than 1 year, I would like to provide a workaround to help. It's simply adding a callback Because it looks like the issue is caused when the table is drawing (my guess is the table gets the div height value before the scroller extension sets it), re-draw it after 0.5 seconds will be fine. (You can set a longer timeout if 0.5s is not enough for you). The working examplelibrary(shiny)
library(DT)
server <- function(input, output) {
output$irisData <- DT::renderDataTable({
DT::datatable(
iris,
rownames = FALSE,
escape = FALSE,
class = 'compact cell-border stripe hover',
extensions = c('Scroller'),
options = list(dom = 'T<"clear">frtiS',
deferRender = TRUE,
scrollY = "500px",
scrollCollapse = TRUE
),
######## just add this callback ##############################
callback = JS("setTimeout(function() { table.draw(true); }, 500);")
#######################################################
) %>%
formatStyle(
'Petal.Length',
backgroundColor = styleInterval(c(1.5, 3.5, 5), c('#9BF59B', '#FFEB99', '#F3B73D', 'transparent'))
)
})
}
ui <- fluidPage(
div(style = 'overflow-x: scroll', DT::dataTableOutput("irisData"))
)
shinyApp(ui = ui, server = server, options = list(port = 5294)) |
Still no fix for this? I get the same error even on the "Client-side data source (50,000 rows)" example after row 53.. $("#Table").DataTable({
data: Content,
deferRender: true,
searching: true,
scrollCollapse: true,
scroller: true,
}); |
@sirzento The workaround I provided above doesn't fix the problem??? I don't understand your problem, if there's anything wrong, please provide a minimal reproducible example, thanks. |
I have the excact same issue like phillc73 here and I wanted to try your Workaround but I dont know how do it with the layout that I have. And I get the same issue on this site after 53 rows too Client-side data source (50,000 rows) |
@sirzento I think you probably confused DT with the javascript library datatables. DT is an R package that makes the using of datatables easier for R users. It should be a bug of Datatables itself because I can see the blank after 53 row in https://datatables.net/extensions/scroller/examples/initialisation/large_js_source.html , too Anyway, regarding to your question, you may try passing the above callback function |
@shrektan Thank you! Very helpful! |
I can't reproduce the issue in the dev version anymore. It may have been addressed in the upstream. So I'll close this issue. |
I'm having this issue with DT 0.3. It seems the issue recurs when combining |
Recently upgraded to DT v0.2 and the rendering of my tables is now incorrect.
Previously, the entire space would be filled with table data, and scrolling would yield many more rows before further data loading was required.
Scrolling down doesn't yield any more rendered rows, but then scrolling back up does start displaying new rows.
Server code producing this table is:
Also with a number of formatStyle() tags for the cell colours.
UI code is:
This code is over a year old now, so I'm sure there's some change I haven't kept up with.
The text was updated successfully, but these errors were encountered: