Hello -- in the code below I am trying to render a dataframe with several records using the old and new datatable elements. The old datatable renders immediately. The new one takes 4-5 seconds. You will need to comment/uncomment sections of the code and run them separately. Use the slider bar to make a bigger df and obviously the times increase even more, although on my machine the refresh for the old datatable is still pretty much instantaneous. Thanks.
==============app.R========================
require(shiny)
#require(DT)
MkDF <- function(nr) {
data.frame(
varid=sample(10000000:20000000,nr,replace=FALSE),
description=sapply(1:nr, function(x) paste(sample(letters,10),collapse="")),
value1=round(runif(nr),3), value2=round(runif(nr),3)
)
}
server <- function(input, output) {
ds <- reactive({ MkDF(strtoi(input$nrows)) })
output$tbl = renderDataTable({ ds() }, options=list(pageLength=10, lengthChange=FALSE, searching=FALSE))
#ds <- reactive({ MkDF(strtoi(input$nrows)) })
#output$tbl = DT::renderDataTable({ DT::datatable(ds(), options=list(pageLength=10, lengthChange=FALSE, searching=FALSE)) })
}
ui <- shinyUI(
navbarPage("Example",
tabPanel("DT - Old",
sliderInput("nrows", label=h6("Number Of Rows"), min=20000, max=30000, value=24000, step=1000, ticks=FALSE),
fluidRow( column(offset=2, width=4, dataTableOutput('tbl')) )
)
#tabPanel("DT - New",
# sliderInput("nrows", label=h6("Number Of Rows"), min=20000, max=30000, value=24000, step=1000, ticks=FALSE),
# fluidRow( column(offset=2, width=4, DT::dataTableOutput('tbl') ) )
#)
)
)
shinyApp(ui=ui, server=server)
===========================================