简体   繁体   English

获取从 Dt 表中选择的行闪亮

[英]Get rows selected from Dt table shiny

WE all know that there is a built in function to get rows selected from DT table as shown below.我们都知道有一个内置函数可以从 DT 表中选择行,如下所示。 Right now, whenever the user clicks on any row at any columns , the row numbers are printed.现在,每当用户单击任何列的任何行时,都会打印行号。 But that should not happen.但这不应该发生。 Instead, only when he clicks on row at specific columns only, the row numbers should be printed.相反,只有当他仅单击特定列的行时,才应打印行号。 IS this possible这可能吗

output$tab <- renderDT({
datatable(iris, selection = 'single',escape = F)
})

observerEvent(input$tab_rows_selected{
print("Clicked")
})

Yes, you can use the event cell_clicked :是的,您可以使用事件cell_clicked

output$tab <- renderDT({
datatable(iris, selection = 'single',escape = F)
})

observerEvent(input$tab_cell_clicked{
specific_col_index <- c(1, 3)
if (input$tab_cell_clicked$col %in% specific_col_index) {
print("Clicked")
}
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM