Below is the application. I need to navigate to next tab when clicked on "I clicked" on DT table. But as per below code, that is not working. Can anyone help me........................................................................
library(shiny)
library(shinydashboard)
library(DT)
# UI ---------------------------------------------------------------------
ui <- fluidPage(
tabsetPanel(
id = "panels",
tabPanel(
"A",
p(),
DTOutput("tab")
# actionLink("link_to_tabpanel_b", "Link to panel B")
# HTML('<a id="Iclickehase" class="action-button" href="#">I clicked</a>')
),
tabPanel(
"B",
h3("Some information"),
tags$li("Item 1"),
tags$li("Item 2"),
actionLink("link_to_tabpanel_a", "Link to panel A")
)
)
)
# Server ------------------------------------------------------------------
server <- function(input, output, session) {
# observeEvent(input$link_to_tabpanel_b, {
# tags$a(href = "#tab-4527-2")
# })
df <- data.frame(a = c(1))
df$b <- HTML('<a id="Iclickehase" class="action-button" href="#">I clicked</a>')
#
output$tab <- renderDataTable({
datatable(df,escape = F,selection = 'none')
})
observeEvent(input$Iclickehase, {
newvalue <- "B"
updateTabItems(session, "panels", newvalue)
})
observeEvent(input$link_to_tabpanel_a, {
newvalue <- "A"
updateTabsetPanel(session, "panels", newvalue)
})
}
shinyApp(ui, server)