From 992071458e3bdf30c7af26eed4d7b6886c671d42 Mon Sep 17 00:00:00 2001 From: Dean Attali Date: Wed, 18 Nov 2020 17:59:05 -0500 Subject: [PATCH] fix bug: disable() didn't work on nested download buttons; fixes #223 --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ inst/srcjs/shinyjs-default-funcs.js | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 60293a8..325b7cc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: shinyjs Title: Easily Improve the User Experience of Your Shiny Apps in Seconds -Version: 2.0.0 +Version: 2.0.0.9000 Authors@R: person("Dean", "Attali", email = "daattali@gmail.com", role = c("aut", "cre")) Description: Perform common useful JavaScript operations in Shiny apps that will diff --git a/NEWS.md b/NEWS.md index c0656a1..ed03384 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# Unreleased version + +- Fix bug: `disable()` did not work on nested download buttons (#223) + # shinyjs 2.0.0 (2020-08-24) - **IMPORTANT CHANGE** Remove commercial license (it only existed because some big companies asked for it, but it ended up being a bigger headache for 99% of the community) diff --git a/inst/srcjs/shinyjs-default-funcs.js b/inst/srcjs/shinyjs-default-funcs.js index b726abb..434b49a 100644 --- a/inst/srcjs/shinyjs-default-funcs.js +++ b/inst/srcjs/shinyjs-default-funcs.js @@ -235,7 +235,7 @@ shinyjs = function() { // enable/disable the container as well as all individual inputs inside // (this is needed for grouped inputs such as radio and checkbox groups) - var toadd = $el.find("input, button, textarea, select"); + var toadd = $el.find("input, button, textarea, select, a[download]"); $el = $($el.toArray().concat(toadd.toArray())); $el.attr('disabled', (method == "disable")); $el.prop('disabled', (method == "disable")); @@ -808,14 +808,14 @@ shinyjs = function() { if ($el === null) return; $el[0].click(); }, - + // refresh the page refresh : function(params) { var defaultParams = { id : null }; params = shinyjs.getParams(params, defaultParams); - + window.location.reload(false); } };