2016-12-08 118 views
0

我正在寫一個閃亮的應用程序,並在UI中我希望單選按鈕和選擇輸入選項在一行中。單選閃爍的單選按鈕和選擇輸入

我的用戶界面。 R文件看起來像:

library(shiny) 
library(shinydashboard) 

dashboardPage(skin = "blue", 
      dashboardHeader(title = 'Analysis'), 

      dashboardSidebar(
      sidebarMenu(
       menuItem("Summary", tabName = "summary", icon=icon("bar-chart")) 
      ) 
     ), 
      dashboardBody( 
      tabItems(
       tabItem(tabName ="summary", 
         fluidRow(
         radioButtons("radio", "Options", 
            list("A","B","C"), inline = TRUE, selected = "A"), 
         selectizeInput("month", "Month", multiple = T, choices = NULL), 
         selectizeInput("year", "Year", multiple = T, choices = NULL) 
          ) 
        ) 
       ) 
     ) 
) 

我怎樣才能使所有三個在一行(在一行)?

+0

有一個非常好的方法來此這裏http://stackoverflow.com/questions/20637248/shiny-4-small-textinput-boxes-side-by-side(我理解你的問題是你希望所有三個控件都在同一行上) – Benjamin

+0

@Benjamin,我之前看過這篇文章,但是我錯過了使用列選項的解決方案。我可以在不寫HTML/CSS代碼的情況下使用列選項將它們放在一行中。謝謝 – krish

回答

0

我修改了ui.R文件,該文件基於這篇文章的解決方案(shiny 4 small textInput boxes side-by-side),並且能夠將所有這三個文件放在一行中。

library(shiny) 
library(shinydashboard) 

dashboardPage(skin = "blue", 
     dashboardHeader(title = 'Analysis'), 

     dashboardSidebar(
     sidebarMenu(
      menuItem("Summary", tabName = "summary", icon=icon("bar-chart")) 
     ) 
    ), 
     dashboardBody( 
     tabItems(
      tabItem(tabName ="summary", 
        fluidRow(
        column(6, radioButtons("radio", "Options", 
           list("A","B","C"), inline = TRUE, selected = "A")), 
        column(3, selectizeInput("month", "Month", multiple = T, choices = NULL)), 
        column(3, selectizeInput("year", "Year", multiple = T, choices = NULL)) 
         ) 
       ) 
      ) 
    ) 
)