0
조건부 패널을 사용하여 Shiny 앱을 동적으로 빌드하고 있습니다. 패널이 기반으로하는 조건은 시작시 평가되지 않습니다. 패널은 기본적으로 표시되며 일부 작업 후에 만 사라집니다. 조건이 충족되지 않아도 패널이 표시됩니다 (input.select1.length = 0, 1보다 작음).반짝이는 조건부 패널이 시작시 평가되지 않음
최소한의 작업 예 :
Server.R :
shinyServer(function(input, output,session){
output$selectInput1 <- renderUI({
selectInput(
inputId = "select1",
label = "Select",
choices = c('1','2','3'),
selected = NULL,
multiple = TRUE
)
})
})
UI.R : @porkchop는 지적
dashboardPage(
title = "",
## Header content + dropdownMenu
dashboardHeader(
title = tags$b(""),
titleWidth = 250
),
## Sidebar content
dashboardSidebar(
width = 250,
sidebarMenu(
id = "tabs",
menuItem("tab1", tabName = "tab", icon = icon("table"))
)
),
## Body content
dashboardBody(
tabItems(
tabItem(tabName = "tab",
div(
div(
style="float: left; padding-left: 20px; padding-right: 20px; width: 350px; background-color: #F4F4F4; height: calc(100vh - 50px) !important;",
uiOutput('selectInput1')
),
div(
conditionalPanel(
condition = "input.select1.length > 1",
p('hi')
)
)
)
)
)
)
)
오른쪽 페이지를 클릭하고 당신이'input.select1.length'을 평가할 때 불평 것을 볼 수 inspect''을 클릭합니다. 그것은 적절한 명령이 아닌 것 같습니다. 'jQuery' https://api.jquery.com/length/ –
Thx @PorkChop을 사용해보십시오. 이 I로 변경됨 conditionalPanel ( 상태 = "! 대해서 typeof input.select1.length == '미정의'" conditionalPanel ( 상태 = "input.select1.length> 0" P ('안녕하세요') ) )하지만 여전히 같은 오류가 발생합니다. 두 번째를 평가하지 않으려면 첫 번째 조건은 무엇입니까? – Dendrobates
다른'renderUI'를 만드는 것이 더 쉽습니다. –