From 6929fd958f07d05879ed1a4de06c186dca7d98de Mon Sep 17 00:00:00 2001 From: Jasper Schelfhout Date: Wed, 31 Jan 2024 15:11:31 +0100 Subject: [PATCH] Prevent greyout when dragging value with increment 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. https://github.com/rstudio/DT/issues/1123 --- editbl/DESCRIPTION | 4 ++-- editbl/R/eDT.R | 6 +++--- editbl/inst/NEWS | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/editbl/DESCRIPTION b/editbl/DESCRIPTION index 7198969..634ef47 100644 --- a/editbl/DESCRIPTION +++ b/editbl/DESCRIPTION @@ -1,7 +1,7 @@ Package: editbl Type: Package -Version: 1.0.3 -Date: 2024-01-04 +Version: 1.0.3-9000 +Date: 2024-01-31 Title: 'DT' Extension for CRUD (Create, Read, Update, Delete) Applications in 'shiny' Authors@R: c(person("Jasper", "Schelfhout", "", "jasper.schelfhout@openanalytics.eu", role = c("aut", "cre")), diff --git a/editbl/R/eDT.R b/editbl/R/eDT.R index 464b5a7..af85aa9 100644 --- a/editbl/R/eDT.R +++ b/editbl/R/eDT.R @@ -718,7 +718,7 @@ eDTServer <- function( shiny::removeModal() }) - observeEvent(input$DT_cells_filled, { + observeEvent(input$DT_cells_filled, { req(!is.null(input$DT_cells_filled) && isTruthy(input$DT_cells_filled)) edits <- input$DT_cells_filled edits$row <- input$DT_rows_current[edits$row] @@ -1256,13 +1256,13 @@ keyTableJS <- c( autoFillJs <- c( "var tbl = $(table.table().node());", "var id = tbl.closest('.datatables').attr('id');", - "table.on('autoFill', function(e, datatable, cells){", + "table.on('preAutoFill', function(e, datatable, cells){", " var out = [];", " for(var i = 0; i < cells.length; ++i){", " var cells_i = cells[i];", " for(var j = 0; j < cells_i.length; ++j){", " var c = cells_i[j];", - " var value = c.set === null ? '' : c.set;", # null => problem in R + " var value = (c.set === null || isNaN(c.set))? '' : c.set;", # null => problem in R " out.push({", " row: c.index.row + 1,", " col: c.index.column,", diff --git a/editbl/inst/NEWS b/editbl/inst/NEWS index 3be8b08..5f40afb 100644 --- a/editbl/inst/NEWS +++ b/editbl/inst/NEWS @@ -1,3 +1,5 @@ +1.0.3-9000 + o Prevent greyout when dragging value with increment. Recently the javascript code of the autofill extension seems to have started returning `NaN` instead of `null`. 1.0.3 o FIX: inputUI argument was not working, now passing on the selected row. o FIX: Evaluate defaults argument for each new row