r - shiny dataTable rows_current and rows_all give the same rows -
i trying provide download handler in shiny app. works fine, grabs current filtered rows , not rows, though use rows_all.
this code reproduces problem. why rows_current , rows_all equal?
ptagg <- data.frame(x = seq(1:100), y = seq(1:100)) ui <- fluidpage( navbarpage('shiny application', tabpanel('overall summary', sidebarlayout( sidebarpanel( checkboxgroupinput('show_vars', 'columns display:', names(ptagg), selected = names(ptagg)), helptext('select columns interested in subset of data displayed'), downloadbutton('downloaddata', 'download data')), mainpanel(div(datatableoutput('overallsummary'), style = 'font-size:80%'), verbatimtextoutput('currrow'), verbatimtextoutput('allrow')) ) ))) server <- function(input, output) { output$overallsummary <- dt::renderdatatable({ select_(ptagg, .dots = strsplit(input$show_vars, ' ')) %>% datatable(options = list(orderclasses = true)) %>% formatcurrency(columns = grep('y', names(ptagg))) }) output$currrow <- renderprint({ cat('current rows: \n') cat(input$overallsummary_rows_current) cat('\n') cat('all rows: \n') cat(input$overallsummary_rows_all) cat('\n') }) } shinyapp(ui = ui, server = server)
Comments
Post a Comment