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

Using extensions = 'Responsive' slows typing into search field #26

Closed
chrlaney opened this issue Mar 16, 2015 · 8 comments
Closed

Using extensions = 'Responsive' slows typing into search field #26

chrlaney opened this issue Mar 16, 2015 · 8 comments

Comments

@chrlaney
Copy link

This is a really wonderful package - thank you! The only problem I have run in so far is that if I add extensions = 'Responsive', I can no longer type characters into the search field at a normal rate - is very slow. I am only an R programmer (and not a great one at that) so any suggestions you might have would be great. Thanks!

@yihui
Copy link
Member

yihui commented Mar 17, 2015

Could you give a reproducible example? I do not see such a problem on this example page: http://rstudio.github.io/DT/extensions.html

@chrlaney
Copy link
Author

Thanks for your response! Here are links to the app (see the Filtered Table tab) without responsive: https://claney.shinyapps.io/dataAvailabilityApp/ - and with responsive: https://claney.shinyapps.io/neonDataAvailability-responsive/. The code in server.R is only different in that extensions = 'Scroller' in the first, and extensions = c('Scroller', 'Responsive') in the second. The full code for the shiny app is in a private repo but here is the code I use to render the filtered table:

  output$filtertable <- DT::renderDataTable(
    DT::datatable(dp2, rownames = FALSE, extensions = c('Scroller','Responsive'),
                  options = list(pageLength = 200, 
                                 pagingType = "full_numbers",
                                 deferRender = TRUE,
                                 dom = 'frtiSp',
                                 order = list(list(0, 'asc'), list(2, 'asc')),
                                 tableTools = list(sSwfPath = copySWF()),
                                 scrollY = 400,
                                 scrollCollapse = TRUE
                                 )))

If you need more than this, I can send you code privately.

@yihui
Copy link
Member

yihui commented Mar 17, 2015

Yes, I can see the second app is slower when I type in the search box, but it is not too bad. I guess the delay is on the magnitude of ~300 milliseconds. Unfortunately, I'm afraid I won't be able to help you with this particular issue, since I'm not the author of the Responsive extension, and I do not know how to make it faster. Is there a reason that you want to use this extension?

@chrlaney
Copy link
Author

It is nice for viewing the table on small screens, like phones, but of course there the delay is even more noticeable, on the order of a second per letter. It is more important that the users can quickly filter the table via search terms than see a condensed table, so for now I will not use the responsive functionality. Perhaps I can drop the extension author a line. Thank you for your help!

@yihui
Copy link
Member

yihui commented Mar 17, 2015

That will be nice. Thanks for your understanding!

@vasiliosz
Copy link

This may be a DT issue after all.
In my Shiny app, I'm seeing this behavior with DT::renderDataTable and DT::datatable and responsive turned on - about 1s per letter in >2000 entry table on MBPro i7 16gb locally.

Duplicating the table but rendering it with shiny::renderDataTable on the same page - there is no delay in searching. And responsive is turned on via the options list instead, as seen below.

And there is actually a (very) slight delay in searching the DT table compared to the shiny table even without the responsive setting.

Since I'm not loading a separate dataTables.responsive.js they're presumably using the same JS library.
Unfortunately, I can't share the full app. The relevant code from server.R:

output$full_table <- DT::renderDataTable({
  data <- data_full()
  ...
  DT::datatable(data,
                  class="table table-striped table-hover table-condensed",
                  rownames = FALSE,
                  escape = FALSE,
                  filter = "bottom",
                  extensions = c('ColReorder','Responsive'),
                  options = list(
                    "pageLength" = 10,
                    dom = 'Rlfrtip')
                  )
  })
output$full_table2 <- shiny::renderDataTable({
  data <- data_full()
  ...
  data
}, options = list(
  "orderClasses" = FALSE,
  "autoWidth" = FALSE,
  "responsive" = TRUE,
  "pageLength" = 10,
  "paging" = TRUE),
"escape" = FALSE
)

@yihui
Copy link
Member

yihui commented Apr 3, 2015

@vasiliosz That is a different case. Shiny uses server-side processing by default, and DT uses client-side processing by default. Please see

@vasiliosz
Copy link

Thanks @yihui. My oversight, it works as expected.

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

3 participants