0

I am facing two issues. Any help would be greatly appreciated as I am a complete newbie to building shiny dashboards. 1) Unable to get the search for individual columns into my first table as the table has >18000 rows. 2) the sidebar conditional panels I created work for each of the tabs, in that they show the columns names for each of the tabs independently, but fail to connect to tabs separately. I think it could be interference from "DT" and shiny dashboard packages?

library(shinydashboard)
library(shinyjs)
library(shiny)
library(DT)
library(markdown)

ui <- dashboardPage(
      dashboardHeader(),
dashboardSidebar(
         headerPanel(),
               conditionalPanel(
                 "$('li.active a').first().html()==='Results'",
                 checkboxGroupInput('show_vars',
                                    'Columns in Results to show:', 
                                    names(Results),
                                    selected = names(Results)),
               actionButton("Results","Submit")),

               conditionalPanel(                
                 "$('li.active a').first().html()==='Processed'",
                 checkboxGroupInput('show_vars', 
                                 'Columns in Processed to show:', 
                                    names(Processed),
                                    selected = names(Processed)),
                 actionButton("processed","Submit")),

               conditionalPanel(                     
                 "$('li.active a').first().html()==='Request'",
                 checkboxGroupInput('show_vars', 
                                    'Columns in Request to show:',
                                    names(Request),
                                    selected = names(Request)),
                 actionButton("Request","submit"))
               ),

 dashboardBody(tabsetPanel(
tabPanel('Results',
         DT::dataTableOutput("mytable1")), 
tabPanel('Processed',
         DT::dataTableOutput ("mytable2")),
tabPanel('Request',
         DT::dataTableOutput ("mytable3")),

  )
  )
  )
  ))



server <- function(input, output) { 


output$mytable1 = renderDataTable({

 DT::datatable(Results, options = list(scrollX = TRUE)) 

 })

 output$mytable2 = DT::renderDataTable({

  DT::datatable(Processed, options = list(scrollX = TRUE),
  filter="bottom", selection="multiple", escape = FALSE) 
  })

 output$mytable3 = renderDataTable({

 DT::datatable(Request, filter="bottom", selection="multiple", escape = FALSE, 
             options = list(scrollX = TRUE))    
   })


   }
Jerry
  • 3
  • 4
  • **A.** This is not [minimal](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610), which is important if you want anybody to read it, or reproducible without data. **B.** Why are you loading `ggplot2` so many times? Why are you loading it at all if you're not using it? (Are you using the rest of the libraries?) Why are you calling each data.frame, and then making a datatable out of it? Why are you passing `datatable` each data.frame twice? **Bottom line:** I want to help you make this awesome, but you need to do some housecleaning first. – alistaire Jun 20 '16 at 00:42
  • @alistaire Thanks a lot for your reply. I reformatted the code. The reason I am using dataframes is because I want to make them available as a way of results reports to someone else at a offsite location in real time, so that I can push some updates. You are right, I am not using ggplots, removed it. but rest I am using. As I am new to this, please suggest any changes as you see would make it better. – Jerry Jun 20 '16 at 01:22
  • Take out the second call of each data.frame within the `datatable` calls; it's going to break things, and doesn't line up with the parameters it takes. (You could take out the calls above the `datatable` calls too, as they'll slow things down, but they won't cause errors.) Also, your code is still not minimal (with 3 iterations of everything) or reproducible (without data to see how it'll work). Don't post your whole app; post a minimal version of it that reproduces your issue. – alistaire Jun 20 '16 at 01:34
  • @alistaire, Thanks. took out the second call in datatable and also the call above datatable. – Jerry Jun 20 '16 at 01:55

0 Answers0