DT icon indicating copy to clipboard operation
DT copied to clipboard

Filter box drop down too small for names on factor variables

Open efsalvarenga opened this issue 5 years ago • 2 comments

When I first render the DT with filter = 'top' and autoWidth = TRUE and click on the filter box the names of the variables does not fit the filter drop down.

image

Minimal reproducible example:

datatable(cbind(iris,iris,iris,iris),
          filter = 'top',
          options = list(autoWidth = TRUE))

The issue has arisen while building this functionality in a shiny application.

Session info:

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763), RStudio 1.3.1093

Locale:
  LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
  LC_TIME=English_United Kingdom.1252    

Package version:
  base64enc_0.1.3   BH_1.72.0.3       crosstalk_1.1.0.1 digest_0.6.25     DT_0.17.1         graphics_4.0.2    grDevices_4.0.2   htmltools_0.5.0  
  htmlwidgets_1.5.3 jsonlite_1.5      later_1.1.0.1     lazyeval_0.2.2    magrittr_1.5      methods_4.0.2     promises_1.1.1    R6_2.3.0         
  Rcpp_1.0.5        rlang_0.4.6       stats_4.0.2       utils_4.0.2       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.

efsalvarenga avatar Jan 27 '21 13:01 efsalvarenga

Tagging @janlimbeck.

efsalvarenga avatar Sep 01 '21 06:09 efsalvarenga

Hello :)

workaround:

<script>
$(document).on('focusin', '.datatables thead  input.form-control', function(event) {

  //console.log('focus');
  largeur_saisie_min = 150;
  if (parseInt($(this).css('width')) <= largeur_saisie_min &
	  $(this).parent().parent().find('.selectized').length==0 ) {
	  $(this).css('width', largeur_saisie_min + 'px');

  }
});

$(document).on('focusout', '.datatables thead  input.form-control', function(event) {
  //console.log('unfocus');
  $(this).css('width', '100%');

});
</script>

philibe avatar Oct 04 '21 16:10 philibe