parsing url and obtaining the same when the url the pasted

I am able to parse the url when the specific row on the table is created. Here 2 things are happening, one is a new tab is created and then the url is getting changed according.

For example, when clicked on row 3, tab 3 is opened and url is changing to "http://127.0.0.1:4692/?tab=3"

But when the above is copied and pasted in another tab, the same is not obtained. Instead a default shiny application is opened. Is there a way to get the same page when that url is pasted in another tab?

library(shiny)
library(readxl)
library(dplyr)
library(xtable)
library(shinyWidgets) ## for picker input
library(shinydashboard) 
library(DT)
library(tidyverse)
library(shinycssloaders)
library(plotly)
library(htmlwidgets)
library(sparkline)
library(data.table)
require(reshape2)
library(glue)


ui <- shinyUI(navbarPage(

  "PaperCut",id = "inTabset",selected = "Summary",
  tabsetPanel(id = "tabs",
          #     tabPanel(
          # "Read me",tags$head(tags$link(rel = "stylesheet", type="text/css", href="style.css"))
          #              ),
              tabPanel(
          "Summary",
    DT::dataTableOutput("tab")))
)
)

server <- function(input, output, session) {

  output$tab <- DT::renderDataTable({
    datatable(iris,selection = 'single')
  })
  
  observeEvent(input$tab_rows_selected, {
    print(input$tab_rows_selected)
  })
 
  
  observeEvent(input$tab_rows_selected, {
    insertTab(inputId = "tabs",
              tabPanel(paste0("tab",input$tab_rows_selected), paste0(input$tab_rows_selected,
                                                                     "This a dynamically-added tab")),select = TRUE
                
    )
  })
  
  observeEvent(input$tab_rows_selected, {
    updateQueryString(
      queryString = sprintf("?tab=%s", input$tab_rows_selected),
      mode = c("replace")
    )
  })
  
}

shinyApp(ui, server)

This topic was automatically closed 21 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.