Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoFill extension returns NaN instead of incrementing #1123

Open
JasperSch opened this issue Jan 31, 2024 · 5 comments
Open

autoFill extension returns NaN instead of incrementing #1123

JasperSch opened this issue Jan 31, 2024 · 5 comments

Comments

@JasperSch
Copy link

JasperSch commented Jan 31, 2024

Hi,

The autoFill extension doesn't properly increment values anymore but instead produces NaN.
It used to work at some point in time.

MWE:

DT::datatable(mtcars,
        options = list(
            autoFill = list(update = TRUE)
        ),
        extensions = 'AutoFill'
    )

Drag a cell and click the increment button.

Screenshot from 2024-01-31 14-49-03

NaN gets filled in:

Screenshot from 2024-01-31 14-53-29

Tested browsers:

Chrome: Version 120.0.6099.129 (Official Build) (64-bit)
Firefox: 122.0 (64-bit)

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_GB.UTF-8          LC_NUMERIC=C                 
 [3] LC_TIME=en_GB.UTF-8           LC_COLLATE=en_GB.UTF-8       
 [5] LC_MONETARY=en_GB.UTF-8       LC_MESSAGES=en_GB.UTF-8      
 [7] LC_PAPER=en_GB.UTF-8          LC_NAME=en_GB.UTF-8          
 [9] LC_ADDRESS=en_GB.UTF-8        LC_TELEPHONE=en_GB.UTF-8     
[11] LC_MEASUREMENT=en_GB.UTF-8    LC_IDENTIFICATION=en_GB.UTF-8

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

other attached packages:
[1] rj_4.0.6-6

loaded via a namespace (and not attached):
 [1] rj.gd_4.0.6-0     digest_0.6.34     crane_0.1.0       R6_2.5.1         
 [5] lifecycle_1.0.4   jsonlite_1.8.8    magrittr_2.0.3    cachem_1.0.8     
 [9] rlang_1.1.3       cli_3.6.2         curl_5.2.0        jquerylib_0.1.4  
[13] bslib_0.6.1       xml2_1.3.6        DT_0.31           ellipsis_0.3.2   
[17] tools_4.1.2       htmlwidgets_1.6.4 crosstalk_1.2.1   yaml_2.3.8       
[21] fastmap_1.1.1     compiler_4.1.2    htmltools_0.5.7   sass_0.4.8       


By filing an issue to this repo, I promise that

  • [ x] I have fully read the issue guide at https://yihui.org/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.

JasperSch pushed a commit to openanalytics/editbl that referenced this issue Jan 31, 2024
Doesn't fully restore the original behavior, but at least prevent
greyouts. Issue has been openen at underlying library in hopes to
support incremental drags again.

rstudio/DT#1123
@mikmart
Copy link
Contributor

mikmart commented Feb 2, 2024

Looks like this is an upstream issue with DataTables, as the same problem can be reproduced in plain HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <link href="https://cdn.datatables.net/1.13.8/css/jquery.dataTables.min.css" rel="stylesheet">
    <link href="https://cdn.datatables.net/autofill/2.6.0/css/autoFill.dataTables.css" rel="stylesheet">
     
    <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
    <script src="https://cdn.datatables.net/1.13.8/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/autofill/2.6.0/js/dataTables.autoFill.min.js"></script>
</head>
<body>
    <table id="mtcars" class="display" style="width: 100%; height: auto;"></table>
    <script>
        new DataTable("#mtcars", {
            columns: [
                { title: "mpg" },
                { title: "cyl" },
                { title: "disp" },
                { title: "hp" },
                { title: "drat" },
                { title: "wt" },
                { title: "qsec" },
                { title: "vs" },
                { title: "am" },
                { title: "gear" },
                { title: "carb" }
            ] ,
            data: [
                [21, 6, 160, 110, 3.9, 2.62, 16.46, 0, 1, 4, 4],
                [21, 6, 160, 110, 3.9, 2.875, 17.02, 0, 1, 4, 4],
                [22.8, 4, 108, 93, 3.85, 2.32, 18.61, 1, 1, 4, 1],
                [21.4, 6, 258, 110, 3.08, 3.215, 19.44, 1, 0, 3, 1],
                [18.7, 8, 360, 175, 3.15, 3.44, 17.02, 0, 0, 3, 2],
                [18.1, 6, 225, 105, 2.76, 3.46, 20.22, 1, 0, 3, 1]
            ],
            autoFill: {
                update: true
            }
        })
    </script>
</body>
</html>

@JasperSch
Copy link
Author

@mikmart
Thank you for pinpointing the exact problem.

I'm less familiar with plain HTML code. Is there any way we could somehow enforce DT to use a version of DataTables in which this feature was still working?

Since the problem in that case has nothing to do with this package, I will try to open an issue upstream at DataTables. Unfortunately it is not immediately clear to me where I should report this to the DataTable developers. I'll add a link here once I figure it out.

@mikmart
Copy link
Contributor

mikmart commented Feb 3, 2024

Is there any way we could somehow enforce DT to use a version of DataTables in which this feature was still working?

DT embeds a specific version of DataTables in each release, so unfortunately at the moment your only option is to try an older version of DT. It you search NEWS.md for "upgraded DataTables" you should be able to find candidate DT versions.

Since the problem in that case has nothing to do with this package, I will try to open an issue upstream at DataTables.

That would be great, thank you!

@JasperSch
Copy link
Author

@mikmart
Seems like it was indeed still working in the previous version of DT. This can be used as a temporary solution:
remotes::install_version('DT', '0.30')

Reported the bug on their free community support page:
https://datatables.net/forums/discussion/78109/bug-is-it-possible-to-fix-incremental-cell-dragging-autofill-extension#latest

Thanks for your help, let's hope they fix it soon.

@JasperSch
Copy link
Author

Quick update: apparently it's already fixed in the upcoming version of DataTables:

https://datatables.net/forums/discussion/78109/bug-is-it-possible-to-fix-incremental-cell-dragging-autofill-extension#latest

So I guess this issue can be closed as soon as the needed releases have happened and the fix is incorporated in DT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants