DT icon indicating copy to clipboard operation
DT copied to clipboard

Column filters not showing when setting language option (internationalisation plug-ins)

Open filipmoren opened this issue 7 years ago • 4 comments

When setting the language option via options(DT.options = list(language = list( url = "https://cdn.datatables.net/plug-ins/1.10.19/i18n/French.json"))) the boxes of the column filters gets rendered behind the table and are thus not visible to the user.

library(DT)

# no language setting
## column filters shows as expected
iris2 = iris[c(1:10, 51:60, 101:110), ]
datatable(iris2, filter = 'top', options = list(
  pageLength = 5, autoWidth = TRUE
))

# setting language to french
## filter boxes gets rendered behind the table (not visible)
options(DT.options = list(language = list(
  url = "https://cdn.datatables.net/plug-ins/1.10.19/i18n/French.json")))

iris2 = iris[c(1:10, 51:60, 101:110), ]
datatable(iris2, filter = 'top', options = list(
  pageLength = 5, autoWidth = TRUE
))

# setting language to english
## filter boxes gets rendered behind the table (not visible)
options(DT.options = list(language = list(
  url = "https://cdn.datatables.net/plug-ins/1.10.19/i18n/English.json")))

iris2 = iris[c(1:10, 51:60, 101:110), ]
datatable(iris2, filter = 'top', options = list(
  pageLength = 5, autoWidth = TRUE
))

# unsetting language
## column filters shows as expected
options(DT.options = list(language = list(
  url = "")))

iris2 = iris[c(1:10, 51:60, 101:110), ]
datatable(iris2, filter = 'top', options = list(
  pageLength = 5, autoWidth = TRUE
))

# using docker rocker/tidyverse:3.5.1

R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.19.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=C             
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] DT_0.4.18

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18      digest_0.6.16     later_0.7.4       mime_0.5         
 [5] R6_2.2.2          xtable_1.8-3      jsonlite_1.5      magrittr_1.5     
 [9] promises_1.0.1    tools_3.5.1       htmlwidgets_1.2.1 crosstalk_1.0.0  
[13] shiny_1.1.0       httpuv_1.4.5      yaml_2.2.0        compiler_3.5.1   
[17] htmltools_0.3.6 

filipmoren avatar Oct 01 '18 14:10 filipmoren

I can reproduce this. I'm afraid it may be related to #554 . The CSS issue...

shrektan avatar Oct 02 '18 09:10 shrektan

Are there any known workarounds? I tried filter = "bottom" but then they go outside of the "screen" while in a flexdashboard. But that might be a flexdashboard issue? filterboxoutoufscreen

filipmoren avatar Oct 02 '18 14:10 filipmoren

I'm afraid not. It looks like a DT issue to me. The cause as explained in #554 is about the CSS stuff of the dropdown menu. Unfortunately, I haven't found a quick solution for this yet...

shrektan avatar Oct 02 '18 16:10 shrektan

Similar here. Trying to localize to German, using a local German.json file (bcs the production server doesn't connect to internet directly) inside of www is not usable: the rendering of the top filters gets overlayed and cut of, not filtering, everything else is in German and works OK:

Example DT::datatable(mtcars, escape = F, rownames = F, filter = "top", selection="multiple", options = list( language = list(url = "German.json"), #locally in www instead of: language = list(url = '//cdn.datatables.net/plug-ins/1.10.11/i18n/German.json'), pageLength = 50, info = T, paging = T, searching = T, scrollX = T, scrollY = "200px" )) ex

Patrikios avatar May 31 '20 10:05 Patrikios