From 67d9a93b69a985ad266ee219277587cedd70c720 Mon Sep 17 00:00:00 2001 From: ericnewkirk <55846615+ericnewkirk@users.noreply.github.com> Date: Wed, 7 Oct 2020 13:19:45 -0600 Subject: [PATCH 1/7] Add namespace for JS (htmlwidgets) avoid intermittent error calling JS() --- R/rhandsontable.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/rhandsontable.R b/R/rhandsontable.R index 0b4eef4..f05f23f 100644 --- a/R/rhandsontable.R +++ b/R/rhandsontable.R @@ -107,7 +107,7 @@ rhandsontable <- function(data, colHeaders, rowHeaders, comments = NULL, res = list(type = type) } res$readOnly = readOnly - res$renderer = JS("customRenderer") + res$renderer = htmlwidgets::JS("customRenderer") res$default = NA res }) From e9072d6f079e5463b3ae92546aedb7cc28969018 Mon Sep 17 00:00:00 2001 From: ericnewkirk <55846615+ericnewkirk@users.noreply.github.com> Date: Wed, 7 Oct 2020 13:25:14 -0600 Subject: [PATCH 2/7] Workaround for phantom change event Avoid firing change event when defaults are null Change event will still fire if defaults are provided --- inst/htmlwidgets/rhandsontable.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inst/htmlwidgets/rhandsontable.js b/inst/htmlwidgets/rhandsontable.js index 627f666..bbb8387 100644 --- a/inst/htmlwidgets/rhandsontable.js +++ b/inst/htmlwidgets/rhandsontable.js @@ -242,7 +242,11 @@ HTMLWidgets.widget({ if (this.params && this.params.columns) { for(var i = 0, colCount = this.countCols(); i < colCount ; i++) { - this.setDataAtCell(ind, i, this.params.columns[i].default); + // added to prevent phantom change event - change will still fire + // if default values are provided + if (this.params.columns[1].default !== null) { + this.setDataAtCell(ind, i, this.params.columns[i].default); + } } } From f3ef9773d203e9861cf4176a642ad0177a890ba8 Mon Sep 17 00:00:00 2001 From: ericnewkirk <55846615+ericnewkirk@users.noreply.github.com> Date: Tue, 29 Dec 2020 19:58:56 -0700 Subject: [PATCH 3/7] Fix phantom change event Change test for reporting changes to R server --- inst/htmlwidgets/rhandsontable.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/inst/htmlwidgets/rhandsontable.js b/inst/htmlwidgets/rhandsontable.js index a52adb4..6a817c4 100644 --- a/inst/htmlwidgets/rhandsontable.js +++ b/inst/htmlwidgets/rhandsontable.js @@ -118,7 +118,7 @@ HTMLWidgets.widget({ } if (HTMLWidgets.shinyMode) { - if (changes && (changes[0][2] !== null || changes[0][3] !== null)) { + if (changes && (changes[0][2] != null || changes[0][3] != null)) { if (this.sortIndex && this.sortIndex.length !== 0) { c = [this.sortIndex[changes[0][0]][0], changes[0].slice(1, 1 + 3)]; } else { @@ -242,11 +242,7 @@ HTMLWidgets.widget({ if (this.params && this.params.columns) { for(var i = 0, colCount = this.countCols(); i < colCount ; i++) { - // added to prevent phantom change event - change will still fire - // if default values are provided - if (this.params.columns[1].default !== null) { - this.setDataAtCell(ind, i, this.params.columns[i].default); - } + this.setDataAtCell(ind, i, this.params.columns[i].default); } } From 649390b42a571f02e985f4cbc1e52ad63e2d655a Mon Sep 17 00:00:00 2001 From: ericnewkirk <55846615+ericnewkirk@users.noreply.github.com> Date: Thu, 4 Feb 2021 11:34:26 -0700 Subject: [PATCH 4/7] Reinstate previous fix Somehow one fix was nixed by the other This commit contains both: Fix phantom change event with 0 rows Fix minsparerows glitch --- inst/htmlwidgets/rhandsontable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/htmlwidgets/rhandsontable.js b/inst/htmlwidgets/rhandsontable.js index bbb8387..53f116a 100644 --- a/inst/htmlwidgets/rhandsontable.js +++ b/inst/htmlwidgets/rhandsontable.js @@ -118,7 +118,7 @@ HTMLWidgets.widget({ } if (HTMLWidgets.shinyMode) { - if (changes && (changes[0][2] !== null || changes[0][3] !== null)) { + if (changes && (changes[0][2] != null || changes[0][3] != null)) { if (this.sortIndex && this.sortIndex.length !== 0) { c = [this.sortIndex[changes[0][0]][0], changes[0].slice(1, 1 + 3)]; } else { From ec7db26de515c087c1f8b7e844d4dba48fdc0c55 Mon Sep 17 00:00:00 2001 From: ericnewkirk <55846615+ericnewkirk@users.noreply.github.com> Date: Thu, 4 Feb 2021 11:37:26 -0700 Subject: [PATCH 5/7] Rebuild package --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9c1727b..17c0f8e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -43,5 +43,5 @@ Suggests: rstudioapi (>= 0.6), htmltools VignetteBuilder: knitr -RoxygenNote: 7.0.2 +RoxygenNote: 7.1.1 Encoding: UTF-8 From 4972363daf7d4e5e0c319358bec86696f3691dcb Mon Sep 17 00:00:00 2001 From: ericnewkirk <55846615+ericnewkirk@users.noreply.github.com> Date: Thu, 4 Feb 2021 12:04:51 -0700 Subject: [PATCH 6/7] Force previous fix Fix for minsparerows is stuck --- inst/htmlwidgets/rhandsontable.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inst/htmlwidgets/rhandsontable.js b/inst/htmlwidgets/rhandsontable.js index 6a817c4..6c575fd 100644 --- a/inst/htmlwidgets/rhandsontable.js +++ b/inst/htmlwidgets/rhandsontable.js @@ -242,7 +242,11 @@ HTMLWidgets.widget({ if (this.params && this.params.columns) { for(var i = 0, colCount = this.countCols(); i < colCount ; i++) { - this.setDataAtCell(ind, i, this.params.columns[i].default); + // added to prevent phantom change event - change will still fire + // if default values are provided + if (this.params.columns[1].default !== null) { + this.setDataAtCell(ind, i, this.params.columns[i].default); + } } } From 94779c6e071f68ad1f8152c43000b71b75240bea Mon Sep 17 00:00:00 2001 From: ericnewkirk <55846615+ericnewkirk@users.noreply.github.com> Date: Thu, 13 Jan 2022 13:49:48 -0700 Subject: [PATCH 7/7] Bump version --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4473517..0940797 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rhandsontable Type: Package Title: Interface to the 'Handsontable.js' Library -Version: 0.3.707 +Version: 0.3.799 Authors@R: c( person("Jonathan", "Owen", email = "jonathanro@gmail.com", role = c("aut", "cre", "cph")), @@ -45,3 +45,4 @@ Suggests: VignetteBuilder: knitr RoxygenNote: 7.1.1 Encoding: UTF-8 +Repository: SPDGT