The code below creates the DataTable output, which I would like to send via email using the email button, similar to the Export button created below. Is there an easy way to add a button so that when you click on it, Microsoft Outlook appears to send data as an attachment, for example, in csv format?
Alternatively, click here and here to help with similar questions.
#Load required packages require(shiny) #Create a dataframe df <- data.frame(random=1:160) server <- function(input,output,session){ #Display df using DataTable and apply desired options output$display <- renderDataTable({df}, option=list(pageLength=100, "dom" = 'T<"clear">lfrtip', "tableTools" = list( "sSwfPath" = "//cdn.datatables.net/tabletools/2.2.3/swf/copy_csv_xls_pdf.swf", "aButtons" = list(list("sExtends" = "csv","oSelectorOpts"=list("page"="all"),"sButtonText" = "Export","aButtons" ="csv"))) ) ) } ui <- shinyUI(fluidPage( #Add a title h1('Testing TableTools'), #Add required JS libraries tagList( singleton(tags$head(tags$script(src='//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js',type='text/javascript'))), singleton(tags$head(tags$script(src='//cdn.datatables.net/tabletools/2.2.3/js/dataTables.tableTools.min.js',type='text/javascript'))), singleton(tags$head(tags$link(href='//cdn.datatables.net/tabletools/2.2.3/css/dataTables.tableTools.css',rel='stylesheet',type='text/css'))) ), mainPanel( #Display results dataTableOutput('display') ) )) shinyApp(ui = ui, server = server)
r shiny datatable tabletools
Bahae omid
source share