4

I encountered a weird situation that made me confused and searched for a while but seems no same issues as mine with data table package.

I simply used the basic default data table in my shiny app, see example:

Server.R

 library(shiny) library(DT) shinyServer(function(input, output) { output$expense_table_check<-renderDataTable({ iris }) }) 

ui.R

library(shiny) shinyUI(fluidPage( mainPanel( navlistPanel( tabPanel("DT",h1("DT"), dataTableOutput("expense_table_check")) ) ) ) ) 

Sometimes the above works fine but sometimes not. I tried replacing dataTableOutput("expense_table_check") with dataTableOutput('expense_table_check') and then it works sometimes, but sometime not.

I also tried replacing the output name expense_table_check with expense_table_check2. But still cannot solve the issue. Any suggestion or comment is appreciated.

7
  • What browser are you using? Also what version of DT nad shiny package are you using? OS too? Everything is working fine at my end Commented Aug 8, 2016 at 9:49
  • Browser : IE, chrome, Safari; OS : Mac and windows, DT version: 0.1, shiny version: 0.13.2 Commented Aug 8, 2016 at 9:53
  • The app that you provided works fine for me, I also have the same versions of the packages. Are you doing anything else after? Commented Aug 8, 2016 at 9:56
  • It's sometime works very fine for me but sometimes it just not display the table . I put apps on 2 different shiny-servers and the issues are the same. Commented Aug 8, 2016 at 10:00
  • Whenever it happens again, right-click on the page and select inspect and see what the page consists of. Commented Aug 8, 2016 at 10:01

1 Answer 1

3

I finally solved the issues after revising the code as following and now it works well all the time; just add DT:: in front of datatable:

Server.R

 library(shiny) library(DT) shinyServer(function(input, output) { output$expense_table_check <- DT::renderDataTable({ iris }) }) 

ui.R

library(shiny) shinyUI(fluidPage( mainPanel( navlistPanel( tabPanel("DT",h1("DT"), DT::dataTableOutput("expense_table_check")) ) ) ) ) 
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you! This just helped me immensely. Is there any reason why this would be the case, though? Why do you have call the DT namespace when the package is already loaded and it works (sometimes)?
Because renderDataTable is also a function in shiny, so there's a conflict
I've got the same issue, but I am using renderDT in my code so I guess this is not the full explaination of the root cause of the issue.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.