datatable - "no matching records found" message when rownames = FALSE

123 views
Skip to first unread message

Galen

unread,
Jul 6, 2017, 10:34:33 AM7/6/17
to Shiny - Web Framework for R
Hi,

The following code works fine and the data table is displayed properly in the UI.


  output$numero_assoluto <- renderDataTable({
   
    if (input$regione != "Tutti") {
      cols = c('Area Territoriale','Regione','Provincia','Scuole Candidabili',
               'Scuole chi hanno Iniziato', 'Scuole chi hanno Inoltrato')
    }
    else {
      cols = c('Area Territoriale','Regione','Scuole Candidabili',
               'Scuole chi hanno Iniziato', 'Scuole chi hanno Inoltrato')
    }
   
    datatable(
      grouped_df(),
      options = list(pageLength = 50, scrollX = TRUE, scrollY = "700px"),
      colnames = cols,
      rownames = FALSE
    )
  })


However, a similarly-created dplyr tbl, gives  "no matching records found" ONLY when I set rownames = FALSE.


 output$percentuali <- renderDataTable({
   
    if (input$regione != "Tutti") {
      cols = c('Area Territoriale','Regione','Provincia','Scuole Candidabili',
               'Scuole chi hanno Iniziato', 'Scuole chi hanno Inoltrato')
    }
    else {
      cols = c('Area Territoriale','Regione','Scuole Candidabili',
               'Scuole chi hanno Iniziato', 'Scuole chi hanno Inoltrato')
    }
   
    datatable(
      percent_df(),
      options = list(pageLength = 50, scrollX = TRUE, scrollY = "700px"),
      colnames = cols,
      rownames = FALSE  # strange, gives a "no matching records found" message when this is enabled
    ) %>%
      formatRound(columns = c('Iniziato', 'Inoltrato'), digits=2)
  })
 

thanks for any help, best

Reply all
Reply to author
Forward
0 new messages