rstudio / blogdown

Create Blogs and Websites with R Markdown
https://pkgs.rstudio.com/blogdown/
1.73k stars 335 forks source link

DT package not working with hugo-future-imperfect theme #88

Closed pssguy closed 7 years ago

pssguy commented 7 years ago

I have a blogdown site based on the hugo-future-imperfect theme where a DT output is created correctly in the rmd but the data is not shown (although the headings are) when applying serve_site/build_site

I have created two brand new sites ( so with no other complications) to illustrate the issue. This is the code and outputs

library(DT)
library(tidyverse)
glimpse(iris)

iris %>% 
  datatable()

a) default theme defaulttheme

b) hugo-imperfect imperfecttheme

The problem also occurs with the plotly package and hugo-imperfect

pssguy commented 7 years ago

Similar to issue 20

Hack solution

Pending a long-term solution, it would be helpful to know which widgets and themes this issue occurs with

ThierryO commented 7 years ago

the issue occurs with hugo-tranquilpeak theme and DT as well

pssguy commented 7 years ago

@ThierryO FYI, I switched to Icarus - with no problems so far

yihui commented 7 years ago

Sorry I don't have time to investigate this issue in hugo-tranquilpeak or hugo-future-imperfect. If I were to do it, I'd first look at the JavaScript console of my browser to see if there are any errors.

andrie commented 6 years ago

For reference, the JavaScript console error is:

Uncaught TypeError: $table.DataTable is not a function
    at Object.renderValue (datatables.js:269)
    at htmlwidgets.js:625
    at Array.forEach (<anonymous>)
    at forEach (htmlwidgets.js:55)
    at htmlwidgets.js:551
    at Array.forEach (<anonymous>)
    at forEach (htmlwidgets.js:55)
    at Object.window.HTMLWidgets.staticRender (htmlwidgets.js:549)
    at HTMLDocument.<anonymous> (htmlwidgets.js:638)

The StackOverflow question is related, and it seems the most likely underlying root cause is that jQuery should be loaded before jQuery datatables.

yihui commented 6 years ago

Appendix D.6 might be helpful: https://bookdown.org/yihui/blogdown/html-widgets.html

andrie commented 6 years ago

I switched to use the Icarus theme.

jarrodscott commented 4 years ago

Can anyone please tell me if there is a good fix for this? Aside from switching themes? I have the same problem in Hugo-Academic & Tranquilpeak. This Stackoverflow solution sort of works but the datatable doesn't look good and the container is not responsive.