How to create hyperlink on element of R Shiny application?

Let see the following application.

When a user sees a table and clicks on the hyperlink "B" I would like to go into "Letters" and have selected the value "B" there.

How it can be done?

library(shiny)
library(DT)
library(data.table)

server <- function(input, output, session) {
  
  output$uo_selector <- renderUI({
    selectizeInput(
      'si_letters', 'Letters', 
      choices = c("A", "B", "C"),
      multiple = FALSE, selected = "A")
  })
  
  df_table <- reactive({
    data.table(
      letters = c(
        paste0("<a href='Go to selector with value A'>", "A", "</a>"),
        paste0("<a href='Go to selector with value B'>", "B", "</a>"),
        paste0("<a href='Go to selector with value C'>", "C", "</a>")),
      numbers = c(1, 2, 3)
    )
    
  })
  
  output$dt_table <- renderDataTable(
    df_table(), escape = FALSE, options = list(pageLength = 5))
  
}

ui <- fluidPage(
  navbarPage('TEST', 
             tabPanel("Table",
                      fluidPage(
                        fluidRow(dataTableOutput("dt_table")))),
             
             tabPanel("Letters",
                      fluidPage(
                        fluidRow(uiOutput("uo_selector"))))
             
  )
)

# Run the application 
shinyApp(ui, server)

This is a crosspost. I already gave an answer here.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.