1
我想使用用戶可以更改的radioButtons在數據表中顯示列。使用radioButtons在數據表中顯示列(閃亮)
到目前爲止,我的代碼是:
UI:
fluidRow(column(4, radioButtons("radio","Choose:",c("A","B"))))),
fluidRow(DT::dataTableOutput("table"))
服務器:
輸出
$table <- DT::renderDataTable({
DT::datatable({table
if (input$radio != "A") {
table <- table[,1:5]
}
if (input$radio != "B") {
table <- table[,6:10)]
}
table
})},rownames = FALSE,options = list(lengthMenu = c(25,50,100)))
當我運行應用程序時,它顯示的是帶A和B但無數據表的radioButton。
爲什麼不只是使用colVis擴展? https://rstudio.github.io/DT/extensions.html –
在你的'output $ table'的第2行,'DT :: datatable({table'什麼是「表」? –
@Addison Hayes Can you如果對你有幫助,接受答案? – Santosh