美文网首页
[R-shiny]弹出提示框

[R-shiny]弹出提示框

作者: expgene | 来源:发表于2023-10-15 11:43 被阅读0次

    探序基因计算中心整理

    效果图:

    代码:

    library(shiny)

    library(shinyBS)

    ui =fluidPage(

      textOutput("curName"),

      br(),

      textInput("newName", "Name of variable:", "myname"),

      br(),

      actionButton("BUTnew", "Change"),

      bsModal("modalnew", "Change name", "BUTnew", size = "small",

              HTML("Do you want to change the name?"),

              actionButton("BUTyes", "Yes"),

              actionButton("BUTno", "No")

      )

    )

    server = function(input, output, session) {

      values <- reactiveValues()

      values$name <- "myname";

      output$curName <- renderText({

        paste0("Current name: ", values$name)

      })

      observeEvent(input$BUTyes, {

        toggleModal(session, "modalnew", toggle = "close")

        values$name <- input$newName

      })

      observeEvent(input$BUTno, {

        toggleModal(session, "modalnew", toggle = "close")

        updateTextInput(session, "newName", value=values$name)

      })

    }

    runApp(list(ui = ui, server = server))

    相关文章

      网友评论

          本文标题:[R-shiny]弹出提示框

          本文链接:https://www.haomeiwen.com/subject/wsmmlltx.html