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.
		
		
		
		
			
				
					49 lines
				
				1.1 KiB
			
		
		
			
		
	
	
					49 lines
				
				1.1 KiB
			| 
											4 years ago
										 | #' tab UI Function | ||
|  | #' | ||
|  | #' @description A shiny Module. | ||
|  | #' | ||
|  | #' @param id,input,output,session Internal parameters for {shiny}. | ||
|  | #' | ||
|  | #' @noRd  | ||
|  | #' | ||
|  | #' @importFrom shiny NS tagList  | ||
|  | #' @import DT | ||
|  | mod_tab_ui <- function(id){ | ||
|  |   ns <- NS(id) | ||
|  |   tagList( | ||
|  |      | ||
|  |     DT::dataTableOutput(ns("tab")) | ||
|  |   | ||
|  |   ) | ||
|  | } | ||
|  |      | ||
|  | #' tab Server Functions | ||
|  | #' | ||
|  | #' @noRd  | ||
|  | mod_tab_server <- function(id,dat){ | ||
|  |   moduleServer( id, function(input, output, session){ | ||
|  |     ns <- session$ns | ||
|  |     output$tab<- DT::renderDataTable({ | ||
|  |       validate( | ||
|  |         need(nrow(dat)>0, 'Wait. Wrong button. There is nothing here. CLick something else.') | ||
|  |       ) | ||
|  |       DT::datatable(dat, | ||
|  |                     filter="top", | ||
|  |                     options = list(scrollX=TRUE, | ||
|  |                                    scrollY=TRUE, | ||
|  |                                    paging = TRUE, searching = TRUE, | ||
|  |                                    fixedColumns = FALSE, autoWidth = TRUE | ||
|  |                                    )) | ||
|  |        | ||
|  |     }) | ||
|  |      | ||
|  |   | ||
|  |   }) | ||
|  | } | ||
|  |      | ||
|  | ## To be copied in the UI | ||
|  | # mod_tab_ui("tab_ui_1") | ||
|  |      | ||
|  | ## To be copied in the server | ||
|  | # mod_tab_server("tab_ui_1") |