Download Selected Rows with DT


#1

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 but want my button inside the table.

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)
```