我试图在input$Product !=A && input$month !="All"使用 Shinyjs 包时禁用闪亮的应用程序单选按钮(“趋势”),但没有成功。
我的 ui 页面定义为:
ui <- fluidPage(
shinyjs::useShinyjs(),
pageWithSidebar(
titlePanel("Analytics"),
sidebarPanel(
selectInput("product",
label = "Choose a Product",
choices = list("A", "B", "C", "All")),
selectInput("month",
label = "Choose TimeFrame",
choices = list("June", "July", "August", "September", "All")),
radioButtons('ptype', label ="Plot Type",
c(Histogram = 'histogram',
Box = 'boxp',
Trend = 'trendp')
)
),
Run Code Online (Sandbox Code Playgroud)
我的服务器端代码:
shinyServer(function (input, output, session) {
mydata<- read.csv("mydataQ1fy16.csv")
observe({shinyjs::toggleState("trendp", input$product != "A" && input$month != "All") })
getMonthproduct <- reactive( {
if(input$month …Run Code Online (Sandbox Code Playgroud)