Learn R Programming

QurvE (version 1.1.1)

updateResistantPopover: Create an update-resistant popover for a Shiny element

Description

This function creates a popover that is resistant to updates in the associated Shiny element. It adds an event listener to the specified element, which reinstalls the popover whenever a child of the element changes.

Usage

updateResistantPopover(
  id,
  title,
  content,
  placement = "bottom",
  trigger = "hover",
  options = NULL
)

Value

A Shiny HTML tag that contains the JavaScript code for creating the update-resistant popover.

Arguments

id

The id of the Shiny element to which the popover is attached.

title

The title of the popover.

content

The content of the popover.

placement

The placement of the popover relative to the Shiny element (default: "bottom"). Possible values are "top", "bottom", "left", and "right".

trigger

The event that triggers the display of the popover (default: "hover"). Possible values are "hover", "focus", and "click".

options

A list of additional options for the popover.

Author

K. Rohde (stack overflow)

Examples

Run this code
if (FALSE) {
library(shiny)
library(shinyBS)

ui <- shinyUI(fluidPage(
  selectInput("Main2_1","Label","abc",  selectize = TRUE, multiple = TRUE),
  updateResistantPopover("Main2_1", "Label", "content", placement = "right", trigger = "focus"),
  actionButton("destroy", "destroy!")
))

server <- function(input, output, session){
  observeEvent(input$destroy, {
    updateSelectInput(session, "Main2_1", choices="foo")
  })
}

shinyApp(ui, server)
}

Run the code above in your browser using DataLab