2
我試圖做一個shiny
應用下載filtred Datatable
:[R閃亮下載filtrered數據表(DT)
- 過濾與
searsh
- 刪除符合
delete button
(下載部分按預期工作)
問題:當我第一次用searsh過濾REA從數據表中,如果我刪除與按鈕的直線將其重置第一過濾
我reproductible爲例:編輯工作液
library(shinydashboard)
library(DT)
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "Info boxes"),
dashboardSidebar(),
dashboardBody(
fluidRow(DT::dataTableOutput('data')),
fluidRow(p(class = 'text-center', downloadButton('x3', 'Download Filtered Data')))
)
)
server <- function(input, output) {
df <- reactiveValues(data = data.frame(
Value1 = 1:10,
Value2 = c("A", "B", "C", "D", "E"),
stringsAsFactors = FALSE,
row.names = 1:10
))
output$data <- DT::renderDataTable(
df$data, server = TRUE, filter = 'top', escape = FALSE, selection = 'none')
# download the filtered data
output$x3 = downloadHandler('emergence filtré.csv', content = function(file) {
s = input$data_rows_all
write.table(df$data[s,], file ,sep=";",row.names = F)
})
}
shinyApp(ui = ui, server = server)
謝謝
它的工作我編輯的代碼(和刪除刪除按鈕) –