We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
library(shiny) library(DT)
data <- data.frame( ID = 1:20, Name = letters[1:20], Section = paste0("section", 1:20) )
ui <- fluidPage( titlePanel("DataTable with Section Links"), mainPanel( DTOutput("mytable") ), fluidRow( column(12, tags$h2("Sections"), lapply(1:20, function(i) { tags$div(id = paste0("section", i), paste("Section", i, "content")) }) ) ) )
server <- function(input, output) { output$mytable <- renderDT({ datatable(data, options = list( columnDefs = list( list( targets = 3, render = JS( 'function(data, type, row, meta) {', 'return "<a href='#" + data + "'>" + data + "";', '}' ) ) ) ) ) }) }
shinyApp(ui = ui, server = server)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Below code works in IDE but not when i deploy to posit connect. Any idea ?
library(shiny)
library(DT)
Sample data
data <- data.frame(
ID = 1:20,
Name = letters[1:20],
Section = paste0("section", 1:20)
)
Define UI
ui <- fluidPage(
titlePanel("DataTable with Section Links"),
mainPanel(
DTOutput("mytable")
),
fluidRow(
column(12,
tags$h2("Sections"),
lapply(1:20, function(i) {
tags$div(id = paste0("section", i), paste("Section", i, "content"))
})
)
)
)
Define server logic
server <- function(input, output) {
output$mytable <- renderDT({
datatable(data,
options = list(
columnDefs = list(
list(
targets = 3,
render = JS(
'function(data, type, row, meta) {',
'return "<a href='#" + data + "'>" + data + "";',
'}'
)
)
)
)
)
})
}
Run the application
shinyApp(ui = ui, server = server)
The text was updated successfully, but these errors were encountered: