GithubHelp home page GithubHelp logo

Comments (8)

yihui avatar yihui commented on May 18, 2024

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

from dt.

chrlaney avatar chrlaney commented on May 18, 2024

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.

from dt.

yihui avatar yihui commented on May 18, 2024

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?

from dt.

chrlaney avatar chrlaney commented on May 18, 2024

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!

from dt.

yihui avatar yihui commented on May 18, 2024

That will be nice. Thanks for your understanding!

from dt.

vasiliosz avatar vasiliosz commented on May 18, 2024

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
)

from dt.

yihui avatar yihui commented on May 18, 2024

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

from dt.

vasiliosz avatar vasiliosz commented on May 18, 2024

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

from dt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.