Skip to content

Instantly share code, notes, and snippets.

@jhollist
Last active October 23, 2015 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhollist/eb5fabf42cc1181c7508 to your computer and use it in GitHub Desktop.
Save jhollist/eb5fabf42cc1181c7508 to your computer and use it in GitHub Desktop.
library(shiny)
library(dplyr)
library(DT)
dat<-data.frame(letters=c(rep("A",15),rep("B",5),rep("C",5)))
server<-shinyServer(function(input, output) {
#Returns filtered data
output$dat_false <- renderDataTable(dat,filter = "top",server = FALSE)
#Returns just the currently (?) visible values in the mainPanel
output$dat_true <- renderDataTable(dat,filter = "top",server = TRUE)
#This code modifeied from: https://yihui.shinyapps.io/DT-info/
output$x5 = renderPrint({
cat('\n\nAll rows with server = TRUE:\n\n')
cat(input$dat_true_rows_all, sep = ', ')
cat('\n\nAll rows with server = FALSE:\n\n')
cat(input$dat_false_rows_all, sep = ', ')
})
})
ui<-shinyUI(
fluidPage(
sidebarLayout(
sidebarPanel(verbatimTextOutput('x5')),
mainPanel(dataTableOutput("dat_true"),
dataTableOutput("dat_false"))
)
)
)
shinyApp(ui,server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment