Use href infobox as actionbutton

前端 未结 3 761
执念已碎
执念已碎 2020-12-17 00:49

I was building an App with Rshiny.

I have a couple of infoBoxand I would like to use the href option to make a po

3条回答
  •  天命终不由人
    2020-12-17 00:53

    I was stuck with the same problem and having gone through this link, just got it working, without adding a separate button, like this. Hope this would help someone looking to solve a similar problem

    require(shiny)
    require(shinydashboard)
    require(shinyBS)
    
    
    header <- dashboardHeader(title="ReproductibleExample")
    sidebar <- dashboardSidebar(disable=T)
    body <- dashboardBody(valueBoxOutput("box_01"),
                          textOutput("print"),bsModal("mod","title","btn"))
    
    ui <- dashboardPage(header, sidebar, body)
    
    
    server<-shinyServer(function(input, output,session) {
    
      output$box_01 <- renderValueBox({
      entry_01<-20
      box1<-valueBox(value=entry_01
                     ,icon = icon("users",lib="font-awesome")
                     ,width=NULL
                     ,color = "blue"
                     ,href="#"
                     ,subtitle=HTML("Test click on valueBox")
                     )
        box1$children[[1]]$attribs$class<-"action-button"
        box1$children[[1]]$attribs$id<-"button_box_01"
        return(box1)
      })
     observeEvent(input$button_box_01, {
      toggleModal(session,"mod","open")
      output$print<-renderText({
        print(input$button_box_01)
      })})
    })
    
    shinyApp(ui,server)
    

提交回复
热议问题