'Responsive' datatable container

I am probably using the term "responsive" incorrectly in this context but I am trying to create a table using DT in blogdown/Hugo where the container adjusts to the "Show entries" selection, like the first table on the DT page. I am able to do this in a regular html document usinng knitr/R markdown but cannot get this behavior in blogdown. My understanding is that to have an html widget in blogdown (with Hugo?) I need to use widgetframe package. Cool. The widgetframe documentation has a demonstration with the DT package here. As you can see though, when you adjust the "Show entries" the container stays the same.

A minimal example for straight-up R Markdown/knitr html document is where container responds to "Show entries".


A minimal example using widgetframe in blogdown where container does not responds to "Show entries".

dt <-  datatable(
  head(iris, 20), 
  options = list(
     columnDefs = list(list(className = 'dt-center', targets = 5)),
     pageLength = 5, lengthMenu = c(5, 10, 15, 20)),
  fillContainer = T)

frameWidget(dt, height = 350, width = '95%')

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.