0

The script when executed creates a red circle icon and a reactive scatterplot below. I have made the script such that upon choosing a choice "A","B","C", we are able to update the plot dynamically. However, clicking the red circle, I just the see the first choice in the dropdown. I want to see all the choices in this dropdown. I shall attach the screenshot for you.

## app.R ##
library(shiny)
library(shinydashboard)
library(shinyWidgets)

ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
),
dashboardBody(
dropdownButton(
pickerInput(inputId = "statnames", 
              label = "", 
              choices = c("A", 
                          "B", 
                          "C", 
                          "D", 
                          "E", 
                          "F"), 
              choicesOpt = list(icon = c("glyphicon glyphicon-arrow-right", 
                                         "glyphicon glyphicon-cog", 
                                         "glyphicon glyphicon-play", 
                                         "glyphicon glyphicon-ok-sign", 
                                         "glyphicon glyphicon-euro", 
                                         "glyphicon glyphicon-music")), 
              options = list(`icon-base` = "")),
  circle = TRUE, status = "danger", icon = icon("gear"), width = "300px",
  tooltip = tooltipOptions(title = "Click to see inputs !")),
  plotOutput("state")
  )
  )
server <- function(input, output) 
{
output$state = renderPlot(
if(input$statnames == "A")
 plot(iris$Sepal.Length)
else
 if(input$statnames == "B")
   plot(iris$Sepal.Width)
else
 if(input$statnames == "C")
   plot(iris$Petal.Width)
else
 if(input$statnames == "D")
   plot(iris$Petal.Length)
else
 if(input$statnames == "E")
   plot(iris$Sepal.Width)
else
 if(input$statnames == "F")
   plot(iris$Sepal.Length)
else
 return()
 )
 }
 shinyApp(ui, server)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ashmin Kaul
  • 860
  • 2
  • 12
  • 37
  • 1
    You are facing the same issue as in [this](https://github.com/dreamRs/shinyWidgets/issues/3) link which says that `pickerInput` is itself a dropdown, and in Bootstrap you cannot put a dropdown inside a dropdown – SBista Sep 15 '17 at 11:20
  • Thanks for replying, So, is there any alternative? – Ashmin Kaul Sep 15 '17 at 11:26
  • 1
    You could use `selectInput` instead of `pickerInput` or follow the suggestion in [this](https://github.com/dreamRs/shinyWidgets/issues/15) link which tells you to use `dropdown` instead of `dropdownButton` – SBista Sep 15 '17 at 11:30
  • Thanks a lot SBista problem solved :) – Ashmin Kaul Sep 15 '17 at 11:57
  • @SBista, Hi, can you please help me with the post here related to pickerInputs and conditional panel ,https://stackoverflow.com/questions/49024653/using-conditional-panel-with-pickerinput-in-r – Adam Shaw Feb 28 '18 at 08:32

0 Answers0