DataTable Unexpected Behavior

245 views
Skip to first unread message

Jason LaCombe

unread,
Nov 12, 2013, 9:11:15 AM11/12/13
to shiny-...@googlegroups.com
Hi All,

  I am encountering some (I believe) unexpected behavior when I attempt to display a dataTable. When I display the table, my goal is to remove the majority of the sort/pagination/filter/processing options. So far setting bSort=0, bProcessing=0, bPaginate=0, bInfo=0 appears to produce desired results. However when I set bFilter=0, only the "global" filter box in the upper right had corner is removed; the within-column filter boxes remain (I expected bFilter=0 to remove all filter boxes). 

Can anyone help with code to remove the within-column filter boxes (please and thank-you). [Also, I am aware of the column-specific format options, but have so-far been unable to implement them successfully to eliminate the within-column formats]. I have included minimal code below to reproduce the problem:

##################################################################
shinyUI(pageWithSidebar(

  #my code has a header panel;
  headerPanel("Table Example"),

  #my code has a sidebar panel;
  sidebarPanel(helpText("Stuff Here")),

  #table is displayed in the main panel;
  mainPanel(dataTableOutput("myTable"))
))


shinyServer(function(input, output) {

  #example dataTable that produces undesired result;
  output$myTable <- renderDataTable({
    as.data.frame(matrix(sample(1:10,100,replace=TRUE),nrow=20,ncol=10))
  }, options = list(bFilter=0, bSort=0, bProcessing=0, bPaginate=0, bInfo=0))

})
##################################################################

[Behavior appears both running from server and locally. Shiny 0.7.0.99. Using Google Chrome]


Thanks,
Jason

Jason LaCombe

unread,
Nov 18, 2013, 1:32:21 PM11/18/13
to shiny-...@googlegroups.com
As an update, I have the aoColumnDefs parameter syntax working

e.g. (just to validate that the syntax is correct) works

################################################################
shinyServer(function(input, output) {

  #example dataTable that produces undesired result;
  output$myTable <- renderDataTable({
    as.data.frame(matrix(sample(1:10,100,replace=TRUE),nrow=20,ncol=10))
  }, options = list(aoColumnDefs = list(list(bVisible=0,aTargets=c(list(0),list(1),list(2))))  ))
})
################################################################,

but the bSearchable parameter also appears not to function 

################################################################
shinyServer(function(input, output) {

  #example dataTable that produces undesired result;
  output$myTable <- renderDataTable({
    as.data.frame(matrix(sample(1:10,100,replace=TRUE),nrow=20,ncol=10))
  }, options = list(aoColumnDefs = list(list(bSearchable=0,aTargets=c(list(0),list(1),list(2))))  ))
})
################################################################

Anyone else have a workaround?

Yihui Xie

unread,
Nov 18, 2013, 2:32:46 PM11/18/13
to Jason LaCombe, shiny-...@googlegroups.com
Sorry, but some DataTables parameters are currently not handled on the
R side. Note renderDataTable() actually processes data using R instead
of JavaScript (http://datatables.net/usage/server-side), and we still
have to catch up some missing features in the current implementation.
Hopefully this will not take very long. Thanks for the feedback!

Regards,
Yihui
--
Yihui Xie <yi...@rstudio.com>
Web: http://yihui.name

Jason LaCombe

unread,
Nov 18, 2013, 4:39:36 PM11/18/13
to shiny-...@googlegroups.com, Jason LaCombe
Thanks! 

Jason LaCombe

unread,
Nov 22, 2013, 1:33:58 PM11/22/13
to shiny-...@googlegroups.com, Jason LaCombe
The solution to the above problem  (modified from https://groups.google.com/forum/#!topic/shiny-discuss/YECf_dPip9M/discussion) came from altering the css associated with the table:

mainPanel(
  dataTableOutput("myTable"),
  tags$style(type="text/css", '#myTable tfoot {display:none;}')
)
Reply all
Reply to author
Forward
0 new messages