From d1e8368748daba223d516c05cb93abb6af759836 Mon Sep 17 00:00:00 2001
From: Cedric Midoux <cedric.midoux@inra.fr>
Date: Thu, 23 Aug 2018 11:09:50 +0200
Subject: [PATCH] collapsed table

---
 server.R | 20 ++++++++++++++++----
 ui.R     |  2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/server.R b/server.R
index c0f43f6..8663ef2 100644
--- a/server.R
+++ b/server.R
@@ -27,7 +27,7 @@ shinyServer
       options = list(
         dom = "lBtip",
         pageLength = 10,
-        lengthMenu = list(c(10, 25, 50, 100, -1), list('10', '25', '50', '100', 'All')),
+        lengthMenu = list(c(10, 25, 50, 100,-1), list('10', '25', '50', '100', 'All')),
         buttons = list(
           'colvis',
           list(
@@ -150,10 +150,22 @@ shinyServer
     data16S()
   })
   
-  output$sampledataTable <- renderTable({
+  output$sampledataTable <- renderUI({
     validate(need(sample_data(data16S(), errorIfNULL = FALSE), ""))
-    sapply(sample_data(data16S()), class)
-  }, rownames = TRUE, colnames = FALSE, caption = "Class of sample_data", caption.placement = "top")
+    box(
+      title = "Class of sample_data",
+      width = NULL,
+      status = "primary",
+      collapsible = TRUE,
+      collapsed = TRUE,
+      renderTable({
+        (sapply(sample_data(data16S()), class))
+      }, rownames = TRUE, colnames = FALSE)
+    )
+    
+    #sapply(sample_data(data16S()), class)
+    #}, rownames = TRUE, colnames = FALSE, caption = "Class of sample_data", caption.placement = "top")
+  })
   
   output$summaryTable <- renderUI({
     validate(need(data16S(), ""))
diff --git a/ui.R b/ui.R
index 42a3eda..cd24170 100644
--- a/ui.R
+++ b/ui.R
@@ -83,7 +83,7 @@ shinyUI(dashboardPage(
       tabPanel(
         "Summary",
         verbatimTextOutput("phyloseqPrint"),
-        tableOutput("sampledataTable"),
+        uiOutput("sampledataTable"),
         withLoader(uiOutput("summaryTable")),
         tags$footer(
           "Questions, problems or comments regarding this application should be sent to ",
-- 
GitLab