DT icon indicating copy to clipboard operation
DT copied to clipboard

searchCols don't update slider range when server=TRUE

Open alexvpickering opened this issue 2 years ago • 0 comments

The slider range isn't set by searchCols when server=TRUE.

Example:

library(shiny)
library(DT)

dt <- datatable(
  iris,
  filter = list(position='top', clear = FALSE, vertical = TRUE, opacity = 0.85),
  rownames = FALSE,
  options = list(
    searchCols = list(
      list(search = '4.3 ... 5.4'),
      list(search = '2.0 ... 2.8'),
      list(search = '1.0 ... 2.9'),
      list(search = '0.1 ... 1.0'),
      NULL
    )
  )
)

# this works (client side)
dt

Client side, the slider shows the specified range:

image

# this doesn't (server side)
shinyApp(
  ui = fluidPage(
    DTOutput('blah')
  ),
  
  server = function(input, output, session) {
    output$blah <- renderDT(dt, server = TRUE)
  }
)

Server side, the slider incorrectly shows the full range:

image

Session info:

R version 4.1.3 (2022-03-10)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora Linux 35 (Workstation Edition), RStudio 2022.2.2.485

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
  LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3   crosstalk_1.2.0   digest_0.6.29     DT_0.23.1         fastmap_1.1.0     graphics_4.1.3   
  grDevices_4.1.3   htmltools_0.5.2   htmlwidgets_1.5.4 jquerylib_0.1.4   jsonlite_1.8.0    later_1.3.0      
  lazyeval_0.2.2    magrittr_2.0.2    methods_4.1.3     promises_1.2.0.1  R6_2.5.1          Rcpp_1.0.8.3     
  rlang_1.0.2       stats_4.1.3       utils_4.1.3       yaml_2.2.1 

By filing an issue to this repo, I promise that

  • [x] I have fully read the issue guide at https://yihui.name/issue/.
  • [x] I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/DT').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

alexvpickering avatar May 20 '22 23:05 alexvpickering