user697110
user697110

Reputation: 599

Datatable to resize with Window In shiny

I have an datatableoutput in a shiny page.The datatable has always 20 rows however I require it for it to re-size it's height according to the size of the window it's in, either by just making it smaller or to reduce the number of rows of the datatable object in a single page with the ability to scroll to the others

I am not finding much info online on how to do this, so I need some tips

Upvotes: 3

Views: 3468

Answers (1)

streof
streof

Reputation: 145

You can define the height op your datatable and the length of your page inside the options argument of your renderDataTable function. Example:

shiny::renderDataTable(
  DT_out, # datatable to return

  options = list(scrollY = '800px', pageLength = 1000) 
  # 800px is the height of the datatable
  # 1000 is just some big number to make sure that all rows fit on 1 page
) 

More options can be found on https://datatables.net/reference/option/

Upvotes: 3

Related Questions