R 在一个闪亮的应用程序中,在同一行中设置小部件
我有一个闪亮的应用程序,它可以生成一个带有一些小部件的wellpanelR 在一个闪亮的应用程序中,在同一行中设置小部件,r,shiny,R,Shiny,我有一个闪亮的应用程序,它可以生成一个带有一些小部件的wellpanel #ui.r navbarPage( "Application", tabPanel("General", sidebarLayout( sidebarPanel( ), mainPa
#ui.r
navbarPage(
"Application",
tabPanel("General",
sidebarLayout(
sidebarPanel(
),
mainPanel(
wellPanel(
h4("Format"),
fluidRow( # Width = sum of component columns
tags$style(type="text/css",
".shiny-output-error { visibility: hidden; }",
".shiny-output-error:before { visibility: hidden; }"
),
column(3,
h5("Booklet ID"),
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num3"))
),
column(
3,h5("Data"),
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num4"))
),
column(3,
uiOutput("c1"),
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num8")),
uiOutput("help1")),
column(
3,
uiOutput("c2"),
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num10")),
uiOutput("help3")
)
),
column(width = 12, fixedRow( # Width = sum of component columns fluidRow
tags$style(type="text/css",
".shiny-output-error { visibility: hidden; }",
".shiny-output-error:before { visibility: hidden; }"
),
column(
3,
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num5"))
),
column(
3,
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num7"))
),
column(
3,
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num9")),
uiOutput("help2")
),
column(
3,
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num11")),
uiOutput("help4")
)
)))
)
)
)
)
#server.r
library(shiny)
server <- function(input, output,session) {
output$num3<-renderUI({
textInput("nm3",
h6("Column"),
value = 1)
})
output$num4<-renderUI({
textInput("nm4",
h6("First Column"),
value = as.numeric(input$nm3)+input$nm5)
})
output$num5<-renderUI({
numericInput("nm5",
h6("Length"),
value = 2)
})
output$num7<-renderUI({
numericInput("nm7",
h6("Length Response"),
value = 1)
})
output$c1<-renderUI({
checkboxInput("ch1",
h5("Person ID"), value = FALSE)
})
output$num8<-renderUI({
if(input$ch1==T){
textInput("nm8",
h6("Column"),
value = 1)
}
else{
output$help1<-renderUI({
helpText("Click Person ID")
})
}
})
output$num9<-renderUI({
if(input$ch1==T){
numericInput("nm9",
h6("Length"),
value = 1)
}
else{
output$help2<-renderUI({
helpText("Click Person ID")
})
}
})
output$c2<-renderUI({
checkboxInput("ch2",
h5("Covariates"), value = FALSE)
})
output$num10<-renderUI({
if(input$ch2==T){
textInput("nm10",
h6("Column"),
value = 1)
}
else{
output$help3<-renderUI({
helpText("Click Covariates")
})
}
})
output$num11<-renderUI({
if(input$ch2==T){
numericInput("nm11",
h6("Length"),
value = 1)
}
else{
output$help4<-renderUI({
helpText("Click Covariates")
})
}
})
}
#ui.r
导航栏页(
“应用程序”,
选项卡面板(“一般”,
侧边栏布局(
侧栏面板(
),
主面板(
井面板(
h4(“格式”),
fluidRow(#宽度=组件列的总和
标记$style(type=“text/css”,
“.Shining输出错误{可见性:隐藏;}”,
“.Shining输出错误:在{可见性:隐藏;}之前”
),
第(3)栏,
h5(“小册子编号”),
div(style=“显示:内联块;垂直对齐:顶部;宽度:150px;”,uiOutput(“num3”))
),
纵队(
3、h5(“数据”),
div(style=“显示:内联块;垂直对齐:顶部;宽度:150px;”,uiOutput(“num4”))
),
第(3)栏,
UIC输出(“c1”),
div(style=“显示:内联块;垂直对齐:顶部;宽度:150px;”,uiOutput(“num8”),
uiOutput(“help1”),
纵队(
3.
UIC输出(“c2”),
div(style=“显示:内联块;垂直对齐:顶部;宽度:150px;”,uiOutput(“num10”),
uiOutput(“help3”)
)
),
列(宽度=12,固定箭头(#宽度=fluidRow组件列之和
标记$style(type=“text/css”,
“.Shining输出错误{可见性:隐藏;}”,
“.Shining输出错误:在{可见性:隐藏;}之前”
),
纵队(
3.
div(style=“显示:内联块;垂直对齐:顶部;宽度:150px;”,uiOutput(“num5”))
),
纵队(
3.
div(style=“显示:内联块;垂直对齐:顶部;宽度:150px;”,uiOutput(“num7”))
),
纵队(
3.
div(style=“display:inline block;垂直对齐:top;width:150px;”,uiOutput(“num9”),
uiOutput(“帮助2”)
),
纵队(
3.
div(style=“显示:内联块;垂直对齐:顶部;宽度:150px;”,uiOutput(“num11”),
uiOutput(“help4”)
)
)))
)
)
)
)
#服务器.r
图书馆(闪亮)
服务器更新:这不起作用,以某种方式迫使第三排离开井面板。这可能是由于CSS、if_else renderUI之类的东西或其他原因造成的。不幸的是,我现在不能投自己的反对票
您只需要将这些列包装在一个fixedRow()
中
对于第二行,请尝试:
column(width = 12, fixedRow( # Width = sum of component columns
column(
3,
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num5"))
),
column(
3,
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num7"))
),
column(
3,
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num9")),
uiOutput("help2")
),
column(
3,
div(style="display: inline-block;vertical-align:top; width: 150px;",uiOutput("num11")),
uiOutput("help4")
)) # One ) for the column, one more for the fixed row. End the fluid row appropriately
这对你有用吗?因为它只是为我把第三条线扔出井面板哦,让我在一两个小时后仔细看看。这适用于我在没有css的情况下构建的应用程序(它对齐了底部的选择条目),当我指定class=“well”
时,我注意到您提供的代码中只有2个FluidRow。我不认为这会迫使第三条线离开井面板,除非我们意外地关闭了上面的井面板,并且在括号外有另一条fluidRow
。我担心这对我仍然不起作用,我的井面板中包含了所有内容。我根据您的解决方案编辑了我的代码,以向您展示我的想法。