0
我有一個shinydashboard應用程序,該應用程序會根據過濾器獲取一個過濾器框和一個顯示數據表的tabset。 我有一個重置按鈕,它可以重置具有shinyjs :: reset功能的濾鏡,並且我還想重置表格並顯示完整的表格或任何內容。 我也想爲valuboxes做。在shinydashboard中重置tableoutput with action按鈕
我的應用程序是這樣的:
對於服務器接口我有一個基本的:output$tableprint_A <- DT::renderDataRable ({})
UI:
body <- dashboardBody(
tabItems(
#### First tab item #####
tabItem(tabName = "fpc",
fluidRow(
infoBoxOutput("kpm_inf", width = 6),
infoBoxOutput(outputId = "fpc_inf", width = 6)
),
fluidRow(
box(title = "Variables filter",
shinyjs::useShinyjs(),
id = "side_panel",
br(),
background = "light-blue",
solidHeader = TRUE,
width = 2,
selectInput("aaa", "aaa", multiple = T, choices = c("All", as.character(unique(fpc$aaa))))
br(),
br(),
p(class = "text-center", div(style = "display:inline-block", actionButton("go_button", "Search",
icon = icon("arrow-circle-o-right"))),
div(style = "display:inline-block", actionButton("reset_button", "Reset",
icon = icon("repeat")))),
p(class = 'text-center', downloadButton('dl_fpc', 'Download Data'))),
tabBox(
title = tagList(),
id = "tabset1",
width = 10,
tabPanel(
"A \u2030 ",
DT::dataTableOutput("tableprint_A"),
bsModal(id = 'startupModal', title = 'Update message', trigger = '',
size = 'large',
tags$p(tags$h2("Last update of A : 01/09/2017",
br(), br(),
"Last update of B : 01/09/2017",
br(), br(),
"Last update of C : 01/09/2017",
style = "color:green", align = "center")))
),
tabPanel(
"B % Table",
DT::dataTableOutput("tableprint_B")),
type = "pills"
)
),
fluidRow(
# Dynamic valueBoxes
valueBoxOutput("info_gen", width = 6)
)
我嘗試這樣做:
observeEvent(input$reset_button, {
output$tableprint_A <- NULL
})
編輯:
我想要那樣的東西,但是當我採取行動時搜索按鈕,我希望它再次出現:
shinyjs::onclick("reset_button",
shinyjs::toggle(id = "tableprint_A", anim = TRUE))
謝謝這正是我一直在尋找! –
不完全是,只有一次,我做了一個新的過濾器,它什麼也沒有顯示 –
你能解釋它是什麼意思:當我做一個新的過濾器? –