Поля в условной панели должны быть расположены рядом с боковой панелью - PullRequest
0 голосов
/ 10 июня 2019

Я разрабатываю приложение в Shiny. Мне нужно разместить поля в условной панели рядом с боковой панелью, но с моим существующим кодом она находится ниже кнопки Перейти. Условная панель должна отображаться только при нажатии кнопки Go и выборе selectInput. Может ли кто-нибудь помочь с этим, пожалуйста?

Я пытался использовать колонку (3, *), но ничего не получилось.

library(shiny)
ui <- fluidPage( 
    titlePanel("Nomenclature Calculator"),
    fluidRow(
        column(3, wellPanel(
            textInput("account","Enter the Account Name",""),
            tags$hr(),
            textInput("advertiser","Enter the Advertiser Name",""),
            tags$hr(),
            textInput("insertionorderid","Enter the Insertion Order ID",""),
            tags$hr(),
            textInput("campaignname","Enter the Campaign Name",""),
            tags$hr(),
            selectInput("dropdown", "Choose from the drop down",
                        list("flight","tactic","AD-Video","AD-NonVideo","Pixel"),selected = FALSE ,multiple = FALSE,selectize = FALSE, size=4),
            tags$hr(),
            actionButton("goButton", "Go")
        )),
        conditionalPanel(
            condition = "input.dropdown == 'flight'",
            textInput("flightname","Enter the flight Name",""),
            selectInput("addedvalue", "Added Value:",
                        c("No","Yes")),
            tags$hr(),
            actionButton("go", "Go")
            #textInput("Tactic Name",paste0("Enter the",input$dropdown, "Name"))
        ),
))

Условная панель должна отображаться только при нажатии кнопки Go и выборе selectInput. А рядом с боковой панелью.

Ответы [ 2 ]

0 голосов
/ 11 июня 2019

Поскольку ваши условные панели являются взаимоисключающими, вы можете поместить их в одну column.Таким образом, у вас не будет нежелательных пробелов.

ui <- fluidPage( 
  titlePanel("Nomenclature Calculator"),
  fluidRow(
    column(3, wellPanel(
      textInput("account","Enter the Account Name",""),
      tags$hr(),
      textInput("advertiser","Enter the Advertiser Name",""),
      tags$hr(),
      textInput("insertionorderid","Enter the Insertion Order ID",""),
      tags$hr(),
      textInput("campaignname","Enter the Campaign Name",""),
      tags$hr(),
      selectInput("dropdown", "Choose from the drop down",
                  list("flight","tactic","AD-Video","AD-NonVideo","Pixel"),
                  selected = FALSE ,
                  multiple = FALSE,
                  selectize = FALSE, 
                  size=4),
      tags$hr(),
      actionButton("goButton", "Go")
    )),
    column(9, 
           conditionalPanel(
             condition = "input.dropdown == 'flight'",
             textInput("flightname","Enter the flight Name",""),
             selectInput("addedvalue", "Added Value:",
                         c("No","Yes")),
             tags$hr(),
             actionButton("go", "Go")
           ),
           #textInput("Tactic Name",paste0("Enter the",input$dropdown, "Name")),
           conditionalPanel(
             condition = "input.dropdown == 'tactic'",
             textInput("tacticname","Enter the tactic Name",""),
             tags$hr(),
             actionButton("go1", "Go")
             #textInput("Tactic Name",paste0("Enter the",input$dropdown, "Name"))
           ),
           conditionalPanel(
             condition = "input.dropdown == 'AD-NonVideo'",
             textInput("channelname","Enter the Channel Name",""),
             tags$hr(),
             textInput("adname","Enter the AD Name",""),
             tags$hr(),
             numericInput("width","Enter the AD Width",""),
             tags$hr(),
             numericInput("height","Enter the AD Height",""),
             tags$hr(),
             actionButton("go2", "Go")
           ))
  )
)

shinyApp(ui, function(input,output){})
0 голосов
/ 10 июня 2019

Попробуйте это:

ui <- fluidPage( 
  titlePanel("Nomenclature Calculator"),
  fluidRow(
    column(3, wellPanel(
      textInput("account","Enter the Account Name",""),
      tags$hr(),
      textInput("advertiser","Enter the Advertiser Name",""),
      tags$hr(),
      textInput("insertionorderid","Enter the Insertion Order ID",""),
      tags$hr(),
      textInput("campaignname","Enter the Campaign Name",""),
      tags$hr(),
      selectInput("dropdown", "Choose from the drop down",
                  list("flight","tactic","AD-Video","AD-NonVideo","Pixel"),
                  selected = FALSE ,
                  multiple = FALSE,
                  selectize = FALSE, 
                  size=4),
      tags$hr(),
      actionButton("goButton", "Go")
    )),
    column(3, conditionalPanel(
      condition = "input.dropdown == 'flight'",
      textInput("flightname","Enter the flight Name",""),
      selectInput("addedvalue", "Added Value:",
                  c("No","Yes")),
      tags$hr(),
      actionButton("go", "Go")
      #textInput("Tactic Name",paste0("Enter the",input$dropdown, "Name")),
    column(3,conditionalPanel(
        condition = "input.dropdown == 'tactic'",
        textInput("tacticname","Enter the tactic Name",""),
        tags$hr(),
        actionButton("go1", "Go")
        #textInput("Tactic Name",paste0("Enter the",input$dropdown, "Name"))
    )),
    column(3,conditionalPanel(
        condition = "input.dropdown == 'AD-NonVideo'",
        textInput("channelname","Enter the Channel Name",""),
        tags$hr(),
        textInput("adname","Enter the AD Name",""),
        tags$hr(),
        numericInput("width","Enter the AD Width",""),
        tags$hr(),
        numericInput("height","Enter the AD Height",""),
        tags$hr(),
        actionButton("go2", "Go")
    ))
           )

    )
  )
)
...