Tuesday, April 26, 2016

Issue with renderDataTable when launch in shiny server but not locally

Leave a Comment

I am deploying our shiny app on shiny server, and am facing issues when we deploy it in shiny server.

When we run the shiny app locally, it works perfectly as we wanted. We use current version of DT locally as well as in shiny server. We used following command to install DT

devtools::install_github('rstudio/DT') 

Following code is for creating the data table in server.R

Ktable is the function which queries data from SQL data base as well as rds files, and combines it.

t(), d(), p() are reactive functions which reads from rds files.

K <- reactive({ Ktable(   t_timestamp = 'submit_ts'   , d_timestamp = 'submit_ts'   , t = t()   , d = d()   , p = p()   , time_slice = tolower(input$slice)   , c_buffer = 0   , f_buffer = 0   , fp_buffer = 0   , c0_buffer = 0   , include_c = FALSE) }) 

Following which, we create the output table Ktab using the renderDataTable() function

output$Ktab <- DT::renderDataTable({   datatable(   K() %>%   arrange(desc(Time)) %>%   as.data.frame   , rownames=FALSE   , extensions = c('Responsive', 'Buttons')   , options = list(       dom = 'Bfrtip'   , buttons = c('pageLength', 'colvis', 'excel', 'pdf')   , lengthMenu = list(c(6, 12, 18, -1), c('6', '12', '18', 'All'))   , pageLength = 12     )    ) }) 

Following code is used in ui.R

fluidRow(     box(       title = "K Table"       ,div(style="display:block; min-width: 100px; width: 20%;float: left;margin: 0 10px;"           ,selectInput('slice', 'Time View'                    , c('Day', 'Week', 'Month', 'Quarter', 'Year')                    , selected = 'Month'))       , DT::dataTableOutput('Ktab')       , status = "primary"       , width = 12       , collapsible = TRUE)     ) 

The error is as follows:

> DataTables warning: table id=DataTables_Table_0 - Ajax error. For more > information about this error, please see <http://datatables.net/tn/7> 

Could anyone share any insight on if this issue is related to shiny server or coding issue?

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment