gpt4 book ai didi

r - Shiny:通过单击 valueBox 触发弹出窗口

转载 作者:行者123 更新时间:2023-12-02 20:01:43 25 4
gpt4 key购买 nike

我想通过单击 valueBox 在弹出窗口中显示数据表。 valueBox 本身应该充当 actionButton

当我单击valueBox时,它应该在弹出窗口中呈现一个表格,如下图所示。

enter image description here

任何人都可以帮忙编写此代码吗?

我的代码:

library(shiny)
library(shinydashboard)

data <- iris

ui <- dashboardPage(
dashboardHeader(title = "Telemedicine HP"),
dashboardSidebar(),
dashboardBody(
fluidRow(
valueBox( 60, subtitle = tags$p("Attended", style = "font-size: 200%;"),
icon = icon("trademark"), color = "purple", width = 4,
href = NULL))))

server <- function(input,output){
}

shinyApp(ui, server)

最佳答案

这是另一个没有 shinyjs 的解决方案

library(shiny)
library(shinydashboard)
library(shinyBS)

data <- iris

ui <- tagList(
dashboardPage(
dashboardHeader(title = "Telemedicine HP"),
dashboardSidebar(),
dashboardBody(
fluidRow(
div(id='clickdiv',
valueBox(60, subtitle = tags$p("Attended", style = "font-size: 200%;"), icon = icon("trademark"), color = "purple", width = 4, href = NULL)
)
),
bsModal("modalExample", "Data Table", "clickdiv", size = "large",dataTableOutput("table"))
)
)
)

server <- function(input, output, session){

output$table <- renderDataTable({
head(data)
})

}

shinyApp(ui, server)

enter image description here

关于r - Shiny:通过单击 valueBox 触发弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55722207/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com