Is there any way to download selected rows with buttons
extension? If not, is there any way to add custom buttons within the table at top left side? I know how to download selected rows. I found we can add custom button to select columns (https://github.com/rstudio/DT/issues/397)
I added 2 custom buttons (mentioned in the code below).
library(shinydashboard)
header <- dashboardHeader(title = 'title')
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem('dashboard', tabName = 'dashboard', icon = icon('dashboard'))
)
)
body <- dashboardBody(
fluidPage(fluidRow(
column(2,
actionButton("downloadData", "Download Selected Rows", icon = icon("download"),
style="color: #333; background-color: #FFF; border-color: #333")),
useShinyalert(),
column(2,
actionButton(inputId = "run", label = "Write Selected Rows to SQL", icon = icon("paper-plane"),
style="color: #333; background-color: #FFF; border-color: #333")),
useShinyalert()
)),
box(
title = 'box', width = NULL, status = 'primary',
DT::dataTableOutput('table2')
)
)
ui<-dashboardPage(header, sidebar, body)
server = function(input, output) {
output$table2 = DT::renderDataTable(
iris, options = list(lengthChange = FALSE)
)
}
shinyApp(ui, server)