【发布时间】:2016-08-05 08:53:19
【问题描述】:
有什么方法可以点击 dataTableOutput 中的元素,然后跳转到不同的 tabPanel?
我知道使用 escape = FALSE 可以将 url 添加到表格元素。但是如何将“跳转到不同的选项卡”添加到 dataTableOutput 元素?并传递价值?
请看一下我的可重现示例。谢谢。
library(shiny)
server <- function(input, output) {
X = data.frame(
ID = c(
"<a href = 'http://www.google.com'> google </a>",
"Click here then Jump to tab2 and pass x=2 and y=2 to tab2",
"Click here then Jump to tab2 and pass x=3 and y=4 to tab2"
),
x = c(1, 2, 3),
y = c(10, 2, 4)
)
output$datatable = renderDataTable({X}, escape = FALSE,
options = list(
paging = FALSE,
searching = FALSE,
filtering = FALSE,
ordering = FALSE
))
output$text = renderText(paste("X = ", "Y = "))
}
ui <- fluidPage(tabsetPanel(
tabPanel("tab1", dataTableOutput("datatable")),
tabPanel("tab2", textOutput("text"))
))
shinyApp(ui = ui, server = server)
【问题讨论】:
标签: javascript jquery r shiny