【发布时间】:2018-02-20 16:57:00
【问题描述】:
我有一个闪亮的仪表板应用程序,该应用程序有一个过滤器框和一个选项卡集,它们根据过滤器显示一个数据表。 我有一个重置按钮,它使用 shinyjs::reset 函数重置过滤器,我还想重置表格集并显示完整的表格或什么也不显示。 我也想为 valueboxes 做这件事。
我的应用是这样的:
对于服务器接口,我有一个基本的:output$tableprint_A <- DT::renderDataRable ({})
界面:
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))
【问题讨论】: