闪亮的数据表行\u current和行\u都给出相同的行
我试图在我的闪亮应用程序中提供一个下载处理程序。它工作得很好,但只获取当前筛选的行,而不是所有行,即使我使用了rows\u all 这段代码再现了这个问题。为什么当前行和当前行都相等闪亮的数据表行\u current和行\u都给出相同的行,r,shiny,dt,R,Shiny,Dt,我试图在我的闪亮应用程序中提供一个下载处理程序。它工作得很好,但只获取当前筛选的行,而不是所有行,即使我使用了rows\u all 这段代码再现了这个问题。为什么当前行和当前行都相等 ptAgg <- data.frame(x = seq(1:100), y = seq(1:100)) ui <- fluidPage( navbarPage('Shiny Application', tabPanel('Overall Summary',
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)
ptAgg这已在DT的开发版本中修复:如果您对历史原因感到好奇: