You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					45 lines
				
				894 B
			
		
		
			
		
	
	
					45 lines
				
				894 B
			| 
											4 years ago
										 | #' downbutt UI Function | ||
|  | #' | ||
|  | #' @description A shiny Module. | ||
|  | #' | ||
|  | #' @param id,input,output,session Internal parameters for {shiny}. | ||
|  | #' | ||
|  | #' @noRd  | ||
|  | #' | ||
|  | #' @importFrom shiny NS tagList  | ||
|  | mod_downbutt_ui <- function(id){ | ||
|  |   ns <- NS(id) | ||
|  |   tagList( | ||
|  |     shinycssloaders::withSpinner( | ||
|  |       type = 5, | ||
|  |       hide.ui=F, | ||
|  |       downloadButton(ns("dbutton"),"Download Full File!") | ||
|  |     ) | ||
|  |   | ||
|  |   ) | ||
|  | } | ||
|  |      | ||
|  | #' downbutt Server Functions | ||
|  | #' | ||
|  | #' @noRd  | ||
|  | mod_downbutt_server <- function(id,dat,nm){ | ||
|  |   moduleServer( id, function(input, output, session){ | ||
|  |     ns <- session$ns | ||
|  |      | ||
|  |     output$dbutton<-downloadHandler( | ||
|  |       filename = function() { | ||
|  |         paste(nm, Sys.Date(), ".csv", sep="") | ||
|  |       }, | ||
|  |       content = function(file) { | ||
|  |         write.csv(dat, file) | ||
|  |       } | ||
|  |     ) | ||
|  |     }) | ||
|  | } | ||
|  |      | ||
|  | ## To be copied in the UI | ||
|  | # mod_downbutt_ui("downbutt_ui_1") | ||
|  |      | ||
|  | ## To be copied in the server | ||
|  | # mod_downbutt_server("downbutt_ui_1") |