有光泽的dataTable rows_current和rows_all给出相同的行

时间:2015-08-19 18:20:40

标签: r shiny dt

我正在尝试在我的闪亮应用中提供下载处理程序。它工作正常,但只抓取当前过滤的行而不是所有行,即使我使用rows_all。

此代码重现了该问题。为什么rows_current和rows_all相等?

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 to Display:', names(ptAgg), selected = names(ptAgg)),
                          helpText('Select the columns you are interested in so that a subset of the data is 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)

0 个答案:

没有答案